Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android XML drawable transparent gradient

I would like some clarification on what the code in front of the HTML color code is called and how it functions.

1) I'm assuming, in the example below, the endColor of #00000000 with the two preceding 00 tells the color to be generated more transparent than say FF.

2) But what's the scale?

3) Is there some kind of hex scale that equates to certain percentages?

I'm really confused and can find no documentation because I'm not even sure of the the terminology I should be searching for other than 'xml transparent gradient' which doesn't 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>
like image 923
TryTryAgain Avatar asked Jun 19 '11 03:06

TryTryAgain


1 Answers

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

like image 63
Pedantic Avatar answered Sep 17 '22 22:09

Pedantic