I am showing list of sting in list view formate, i used default list view and placed a radio button by using simple_list_item_single_choice
. But this shown the Radio button in right side, i want to display the radio button in left side. is that any possible to show the radio button in left side using default list view
simple_list_item_single_choice.xml
use CheckedTextView
class
Here is the simple_list_item_single_choice.xml
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center_vertical"
android:checkMark="?android:attr/listChoiceIndicatorSingle"
android:paddingLeft="6dip"
android:paddingRight="6dip"
/>
You need to create a custom xml for your need and use a CheckBox
to achieve your goal
Here is your custom.xml
<CheckBox
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center_vertical"
android:button="?android:attr/listChoiceIndicatorSingle"
android:paddingLeft="6dip"
android:paddingRight="6dip"
/>
Just use the custom.xml
in place of simple_list_item_single_choice.xml
in your code.
Hope it helps you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With