saeed saeed - 1 month ago 9
Android Question

how to set alpha to fragment dynamically

I have an activity and 8 fragment in it. I want to set 50% alpha to one my fragments dynamically, when user click button .But it seems there is no alpha attribute for fragment.
My main questions is "how to st alpha or visibility dynamically "
any help will be appreciated thanks
i can set visibility by this code but its not perfect

this.findViewById(R.id.fragment1).setVisibility(View.VISIBLE);


and can i cast fragment like view?

Answer
getSupportFragmentManager()
   .findFragmentById(R.id.fragment1)
   .getView().setVisibility(View.VISIBLE)
Comments