Spinner with arrow in left

YFeizi picture YFeizi · Feb 25, 2015 · Viewed 8.6k times · Source

I'm developing an app for RTL language and want to change the position of arrow to the left of Spinner ! Is there anyway to do this without creating a custom spinner ?

Answer

mehmetunlu picture mehmetunlu · Feb 25, 2015

You must write a custom spinner. Sample code is below. You can edit as you wish.

<Spinner
            style="@style/spinner_style"
            android:layout_width="match_parent"
            android:layout_height="wrap content"
             />

@style/spinner_style:

 <style name="spinner_style">
    <item name="android:background">@drawable/background_spinner</item>
</style>

@drawable/background_spinner

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item><layer-list>
        <item><shape>
               <solid android:color="@android:color/white" />
                <corners android:radius="4dp" />
                <padding android:left="8dp"/>
            </shape></item>
        <item><bitmap android:gravity="left"
              android:src="@drawable/ic_arrow_drop_down_grey600_36dp"/>                
        </item>
    </layer-list></item>
</selector>