Android: Spinner text alignment to the right but not centered

前端 未结 3 949
长情又很酷
长情又很酷 2021-01-02 18:09

I finished the English version of my application and now I am working on the Arabic localization. Arabic is a right-to-left language, so I need to adjust a lot of things in

相关标签:
3条回答
  • 2021-01-02 18:49

    Try this:

    android:layout_gravity="right"
    
    0 讨论(0)
  • 2021-01-02 18:50

    change your code

    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_height="?android:attr/listPreferredItemHeight"
        android:layout_width="fill_parent"
        android:gravity="right" />
    

    To

    <TextView
            xmlns:android="http://schemas.android.com/apk/res/android"
            style="?android:attr/listPreferredItemHeight"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="right" />
    
    0 讨论(0)
  • 2021-01-02 18:52

    You have to use CheckedTextView, it will solve your all 3 problems.

    You will place a layout xml something like this:

    <CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android" 
        android:id="@android:id/text1"
        android:drawableLeft="?android:attr/listChoiceIndicatorSingle"
        android:gravity="right|center_vertical"
        android:singleLine="true"
        android:layout_width="fill_parent"
        android:textSize="20dp"
        android:layout_height="?android:attr/listPreferredItemHeight"
        android:ellipsize="marquee" />
    
    0 讨论(0)
提交回复
热议问题