alpha

Change int color opacity in java/android

亡梦爱人 提交于 2019-12-05 05:22:58
I am trying to change the opacity of a color that I get of my theme with the next code: TypedValue typedValueDrawerSelected = new TypedValue(); getTheme().resolveAttribute(R.attr.colorPrimary, typedValueDrawerSelected, true); int colorDrawerItemSelected = typedValueDrawerSelected.data; I want that the colorDrawerItemSelected keeps the same color, buth its alpha should be 25%. I found some solutions getting the rgb color from the imageView, but I havent imageView. Thank you for your time. Wouldn't it be sufficient? colorDrawerItemSelected = (colorDrawerItemSelected & 0x00FFFFFF) | 0x40000000;

Button with getBackground().setAlpha on version 5 - lollipop isn't working correctly

你离开我真会死。 提交于 2019-12-05 03:36:43
问题 I have this code and works for every version since API 14 but on Android 5.0 (Lollipop) isn't working correctly. Below is the way how I want the buttons appear. click of button1 buttonArrivals.getBackground().setAlpha(180); buttonDepartures.getBackground().setAlpha(255); click of button2 buttonArrivals.getBackground().setAlpha(255); buttonDepartures.getBackground().setAlpha(180); On Lollipop version the buttons appear with the same Alpha but I never set the same alpha. I just use the code