Thursday, July 19, 2012

[android-developers] Re: ActionBar with gradient background

Hi,

now I have found a pretty easy way to get a gradient background myself! :-)

Here is how it works

Create a XML file in drawable folder, its content should look like this:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle"
    android:useLevel="false" >
    <gradient
        android:startColor="#000000"
        android:endColor="#ffffff"
        android:useLevel="false"
        android:type="linear"
        android:angle="90" />
</shape>


Second step, adjust your styles.xml file in values folder and add following line to your ActionBar style:

<item name="android:background">@drawable/NAME_OF_CREATED_XML_FILE_WITHOUT_DOT_XML</item>

Now you should have an ActionBar which is black at the top and white at the bottom and transitions the color between bottom and top.

Have fun!

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate