Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spinner with arrow in left

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 ?

like image 468
YFeizi Avatar asked Feb 25 '15 09:02

YFeizi


1 Answers

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>
like image 50
mehmetunlu Avatar answered Sep 28 '22 02:09

mehmetunlu