如何使Android中的复选框CheckedTextView左对齐,而不是右对齐? [英] How do I make the Checkbox in Android CheckedTextView be left aligned instead of right aligned?

查看:239
本文介绍了如何使Android中的复选框CheckedTextView左对齐,而不是右对齐?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用R.layout.simple_list_item_multiple_choice与ListView控件。 CheckedTextView用于simple_list_item_multiple_choice.xml,但我怎样才能使复选框左对齐,而不是右对齐?

I am trying to use R.layout.simple_list_item_multiple_choice with ListView. CheckedTextView is used in simple_list_item_multiple_choice.xml, but how can I make the checkbox be left aligned instead of right aligned?

推荐答案

创建自己的行模板,并设置机器人:在CheckedTextView drawableLeft

Create your own row template and set android:drawableLeft on the CheckedTextView.

<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="fill_parent"
android:layout_height="40dip"
android:gravity="center_vertical"
android:paddingLeft="5dip"
android:drawableLeft="?android:attr/listChoiceIndicatorMultiple"
/>

android:drawableLeft="?android:attr/listChoiceIndicatorSingle"

这篇关于如何使Android中的复选框CheckedTextView左对齐,而不是右对齐?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆