在列表视图中单选按钮 [英] Radio button in list view
问题描述
我显示在列表视图中甲刺的名单,我用默认的列表视图中,并放置一个单选按钮,使用 simple_list_item_single_choice
。但是,这显示在右侧的单选按钮,我想显示在左侧的单选按钮。是,任何可能的使用显示左侧的单选按钮默认列表视图
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
使用 CheckedTextView
类
下面是 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"
/>
您需要创建一个自定义XML您的需求,并使用复选框
来实现自己的目标
这是你的 custom.xml
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"
/>
只需使用 custom.xml
代替 simple_list_item_single_choice.xml
在你的code。
Just use the custom.xml
in place of simple_list_item_single_choice.xml
in your code.
希望它可以帮助你。
这篇关于在列表视图中单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!