Transparent Gradient for Android XML

I would like some clarification on how the code is called before the HTML color code and how it functions.

1) I assume that in the example below, endColor of #00000000 with the previous two 00 indicates that the color will be generated more transparent than say FF .

2) But what is the scale?

3) Is there any kind of hexagram that equates to a certain percentage?

I am really confused and cannot find the documentation, because I am not even sure of the terminology I should look for, except for the "transparent xml gradient", which does not tell me what I want to know.

Any / all help is appreciated. thanks

 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#DD63594A" android:endColor="#00000000" android:angle="90"/> <padding android:left="4dp" android:top="1dp" android:right="4dp" android:bottom="1dp" /> <corners android:bottomRightRadius="1dp" android:bottomLeftRadius="1dp" android:topLeftRadius="7dp" android:topRightRadius="7dp"/> </shape> 
+6
source share
1 answer

It is hexadecimal. The scale is the same as the RGB values ​​in the rest of the color code, so 00 will be alpha=0 and FF will be alpha=255 . Basic math explains the rest.

+10
source

Source: https://habr.com/ru/post/890846/


All Articles