When I make a text view on Android, if there is a background color in the text view, I want to give it about 20% transparency. What should I do?
android android-textview transparency
If you want to give 20% transparency, you can put 80% in the alpha value.
<TextView
...
android:background="#CCFF0000" />
For example, if you want to give 20% transparency to red like the code above, you can give #CCFF0000
.
To explain, you can see CC FF 0000 in two digits after #, each represented by a Hex value, and the preceding CC is an Alpha value, and the higher the value, the more opaque it becomes. And FF is R of RGB and then 0000 is G and B in order.
Each number can be expressed from 0 to 255 (00 to FF), but if 255 is the maximum, if you want to give 20% transparency, you can give 80% of the value. It is 255 * 0.8 = 204
, so if you change it to hexadecimal, it will be 0xCC.
914 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
610 GDB gets version error when attempting to debug with the Presense SDK (IDE)
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
617 Uncaught (inpromise) Error on Electron: An object could not be cloned
© 2024 OneMinuteCode. All rights reserved.