Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Spinner Gravity Not working

I'm trying for days to align the text in a spinner to right, but every time I fail to do it, I tried to set Gravity to right, or ellipsize to end but nothing works and all I have is this :

enter image description here

can you please help with this issue ?

Thanks a lot.

Here's the XML :

<RelativeLayout 
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal" >

<org.holoeverywhere.widget.Spinner
    android:id="@+id/spnCities"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_centerVertical="true"
    android:layout_marginRight="10dp"
    android:entries="@array/array_cities"
    android:gravity="right"/>

<TextView
    android:id="@+id/tvCities"
    android:layout_width="70dp"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_centerVertical="true"
    android:layout_marginLeft="10dp"
    android:text="@string/city"
    android:textAppearance="?android:attr/textAppearanceSmall" />

like image 300
Houssem Avatar asked Dec 17 '12 16:12

Houssem


1 Answers

You probably have to use a custom view to enable this to work. Use google its your best friend...this will probably help:

Align spinner values to right instead of left

like image 191
IZI_Shadow_IZI Avatar answered Sep 24 '22 01:09

IZI_Shadow_IZI