Android Dev Tip #3

Using @android:color/transparent in gradients


If you’re creating a gradient in xml with a part being completely transparent, be really careful when using @android:color/transparent.



(the box in the bottom-right corner is completely transparent, because it’s black with 0% opacity)
(once again the difference between 25% opacity and 0% seems to be bigger than others, but that’s entirely correct… remember it’s essentially a jump from a color to nothing, while others are from a color to a more transparent color)

If you enjoyed this post, please show your support! Recommend, follow, comment, share.

This really means a lot!

senior android engineer @reddit | former android tech lead @getthefabulous | recovering feature creep 💉 |