Question

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,

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top