Glossy gradient with android drawable xml
Asked Answered
S

1

14

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,

Striction answered 21/11, 2011 at 13:23 Comment(1)
Did you get some solution?Beaty
J
9

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

Jourdan answered 22/12, 2011 at 7:6 Comment(1)
Yes, center color is a choice but it will end me up with a 3 color gradient. P.S - I have tried this, but I'm looking for the glossy look to it.Striction

© 2022 - 2024 — McMap. All rights reserved.