Manipulate alpha bytes of Java/Android color int

后端 未结 5 1710
星月不相逢
星月不相逢 2021-01-31 01:14

If I have an int in Java that I\'m using as an Android color (for drawing on a Canvas), how do I manipulate just the alpha component of that int? For example, how can I use an o

5条回答
  •  北恋
    北恋 (楼主)
    2021-01-31 01:41

    This isn't directly answering the question but it's good to remember that View and Drawable have a setAlpha(float alpha) method which might do what you want. Or you might want to try view.getBackground().setAlpha().

提交回复
热议问题