Search code examples
androidandroid-layoutandroid-spinnerdivider

How to show divider between spinner items?


I using listviews and expandedviews that has dividers and I can set them but on spinner its looks like it is no divider between items.

Someone that has a idea of how to fix this?


Solution

  • For people with same problem i after almost gived up i got an idea of how to get the divider.

    I added the divider line at the bottom of my custom layout for each item

    <?xml version="1.0" encoding="utf-8"?>
    

    <RelativeLayout android:id="@+id/RelativeLayout01"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        xmlns:android="http://schemas.android.com/apk/res/android" style="@style/ListItem2">
    
        <TextView android:id="@+id/Text" android:layout_width="fill_parent"
            android:layout_height="wrap_content" android:layout_alignParentLeft="true"
            style="@style/SpinnerView_Text" android:paddingLeft="10dip" />
    
        <ImageView android:id="@+id/icon" android:layout_width="wrap_content"
            android:layout_height="wrap_content" android:src="@drawable/arrowright"
            android:layout_alignParentRight="true" android:layout_centerInParent="true"
            android:layout_marginRight="20dip" />
    
    </RelativeLayout>
    
    <ImageView android:id="@+id/Divider1" android:layout_width="fill_parent"
        android:layout_height="1dip" style="@style/Divider"></ImageView>