Issue
Every image asset I add to my project on Android Studio gets added with an opacity of something like 0.5 and I'm unable to change its opacity programmatically using setAlpha method.
I'm adding it as an Action Bar and Tab Icons type and as Asset Type: Image.
Anyone else had this problem? The asset having an opacity of 1 is quite important for what I'm trying to do.
profileButton = (ImageView) findViewById(R.id.profileButton);
profileButton.setAlpha(1f);
SOLVED: Wasn't anything Android related. Sorry.
Solution
You can not change alpha of your drawable with View.setAlpha() method.
You should create a drawable with no alpha (value:1.0f) and then change alpha of the view if needed.
Drawable is the source used to generate the Bitmap that will be used to fill the ImageView or other elements. Then your view has its own alpha display settings that you can dynamically change.
In your specific case you have to edit your image sources to get them with no alpha, I think you have no other choices. If they are vector resources you have just to change alpha values in source files.
Answered By - smora
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.