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 my layout, including my spinner display.
I used the same approach mentioned here Android - Text is Pushed to the Left in a Spinner but I set the gravity to right.
Here is my spinner_item.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="?android:attr/listPreferredItemHeight"
android:layout_width="fill_parent"
android:gravity="right" />
Changed my code from
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
to this
adapter.setDropDownViewResource(R.layout.spinner_item);
I want my spinner to look like my old English spinner found below,
But it currently looks like this,
How can I restore the following:
- The radio button
- The bigger text size
- I want it to the right as shown but centered between the two dividers.
NOTE The Arabic webservices aren't finished yet, that's why the data in the image is still in English.
UPDATE
After trying Adil Soomro's suggestion, I get the following,
There is no radiobutton and there is a considerable space between the border and the first letter.
UPDATE
After Adil Soomro's edit, I now have the following,
change your code
To
Try this:
You have to use
CheckedTextView
, it will solve your all 3 problems.You will place a layout xml something like this: