Transparent black gradient shape drawable color code

Detoxic Spirit picture Detoxic Spirit · May 12, 2014 · Viewed 22.8k times · Source

gradient for view pager indicator

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient 
        android:startColor="#000"
        android:centerColor="#00000000"
        android:endColor="#000"
        android:angle="270"
        android:dither="true"
     />
</shape>

This is the code I tried but it ends up as pure black.

Answer

Phant&#244;maxx picture Phantômaxx · May 12, 2014

What about this gradient? Full transparency at top to 50% transparent black at bottom

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient 
        android:startColor="#00000000"
        android:endColor="#80000000"
        android:angle="270"
        android:dither="true"
     />
</shape>