Align spinner values to right instead of left

前端 未结 2 1576
猫巷女王i
猫巷女王i 2021-02-13 01:11

In spinner xml, I\'m using:

 android:entries=\"@array/cars\"

where cars is list of numeric items.

The spinner automatically align value

相关标签:
2条回答
  • 2021-02-13 01:52

    You have to use a custom view here to give alignment to the Spinner values. Create a CustomView like this answer has created and add android:gravity to the TextView as right.

    UPDATE:

    Set the CustomView to your adapter using

    adapter.setDropDownViewResource(android.R.layout.your_custom_created_view);
    
    0 讨论(0)
  • 2021-02-13 02:11

    You can use TextAlignment on properties and select TextEnd, or android:textAlignment="textEnd" on XML simple

    0 讨论(0)
提交回复
热议问题