我在列表视图格式中显示刺痛列表,我使用默认列表视图并使用放置了一个单选按钮simple_list_item_single_choice
。但这在右侧显示了单选按钮,我想在左侧显示单选按钮。是否可以使用默认列表视图在左侧显示单选按钮
simple_list_item_single_choice.xml
use CheckedTextView
class
这里是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 并使用CheckBox
实现你的目标
这是你的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
在你的代码中。
希望对您有帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)