tags:

views:

62

answers:

1

I have customised the spinner items background into black color.But border around spinner and the separartor between each spinner item is in white color. I want to change separator color and border to dark gray color.

  • How can i change these color?
  • Is spinner uses list view or some other as parent to populate items in spinner?
  • If so can i change the separator background of parent view?
A: 

I guess it does work as a ListView.

Try this out:

<Spinner 
    android:id="@+id/spinner"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:drawSelectorOnTop="true"
    android:prompt="@string/your_prompt"
    android:headerDividersEnabled="false"
    android:footerDividersEnabled="true"
    android:divider="@drawable/list_divider"
/>

and your list_divider is:

<?xml version="1.0" encoding="utf-8"?>
<layer-list
    xmlns:android="http://schemas.android.com/apk/res/android"&gt;
    <item>
        <shape>
            <gradient
                android:startColor="#000000"
                android:centerColor="#CCCCCC"
                android:endColor="#FFFFFF"
                android:height="1px"
                android:angle="0" />
        </shape>
    </item>
</layer-list>

PS: Also take a look at this tutorial. Seems that it has a lot of info about custom Spinners.

Macarse