Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transparent black gradient shape drawable color code

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.

like image 696
Denny Mathew Avatar asked May 12 '14 08:05

Denny Mathew


People also ask

How do you make a drawable gradient?

To create a gradient color we need to create a . xml file in the drawable folder. So go to app -> res -> drawable and right-click on drawable -> New -> Drawable Resource File and create gradient_drawable.

What is transparent color in Android?

TRANSPARENT (which represents the same thing as @android:color/transparent ) is equal to 0 . The hex representation of 0 is #00000000 , which means that Color. TRANSPARENT is essentially a completely transparent Color.

What is gradient drawable?

A GradientDrawable is drawable with a color gradient for buttons, backgrounds, etc.


1 Answers

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>
like image 112
Phantômaxx Avatar answered Sep 23 '22 14:09

Phantômaxx