Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Glossy gradient with android drawable xml

I'm trying to bring out a glossy xml drawable gradient as a background to a layout. I am already using the start color and end color boring linear gradient.

<item>
    <shape>
        <gradient
            android:angle="90"
            android:startColor="#242424"
            android:endColor="#4e4e4e"
            android:type="linear" />
    </shape>
</item>

Is there any way to control its range of flow? Please some one help.

Edited:

Ok, I have done a little hack around method to get a nice glossy looking title bar,

Linear Layout (with a gradation - drawable background, specifying all the start and end color values separately) Over this are the icons, (I used Image buttons with transparent BG), and over this another Relative Layout (with may be a drawable gradient or a fixed, grey color - for glossiness - android:background="#20f0f0f0" ) Here 20 is defining the Alpha value.

P.S, This might not be a correct work around, but I'm quiet satisfied with this because switching themes according to clients needs is much faster when compared to 9 patch PNG files (hey, BTW this is just my opinion on it)

And this link is so informative on this,

like image 723
Wesley Avatar asked Nov 21 '11 13:11

Wesley


1 Answers

you cant control its range of flow but instead you can use another property centerColor. you should try the center color Property in gradient for glossy background.

i used this in my application .

<gradient
android:startColor="#FFF7F7F7"
android:centerColor="#FFCECFCE"
android:endColor="#FFBEBEBE"
android:angle="270"/>

hope this will work for you

like image 158
Pratik Popat Avatar answered Nov 15 '22 18:11

Pratik Popat