[英]Android CheckBox with right-aligned checking button/box
I am fairly new to Android (find it most fun, btw) and I was wondering... 我是Android的新手(发现它最有趣,顺便说一下),我想知道......
How can I create an Android CheckBox with the label to the left and the checking button/box aligned to the right (pretty much a switch of the way this widget is drawn by default)? 如何创建一个Android CheckBox,左边是标签,右边是检查按钮/框(默认情况下是这个小部件的绘制方式)? Like the way a checkbox preference normally looks like...
就像复选框偏好通常看起来的方式一样......
I am looking for the most elegant/short-coded version possible, if there is one. 我正在寻找最优雅/短编码的版本,如果有的话。 I mean other than creating your own View/ViewGroup with layouts, empty-labeled CheckBoxes and TextViews, etc...
我的意思是除了使用布局创建自己的View / ViewGroup,空标记的CheckBoxes和TextViews等...
Thanks & Regards, 感谢和问候,
尝试使用CheckedTextView
,它是多选ListView
小部件使用的小部件。
CommonsWare's answer is absolutely right but there is one more option which you can use and it's quite easier than CheckedTextView. CommonsWare的答案是绝对正确的,但是你可以使用另外一个选项,它比CheckedTextView更容易。 You can use *simple_item_list_multiple_choice* .
您可以使用* simple_item_list_multiple_choice * 。 it will create list with chekcbox and labels on left and as on the name of extra work you just have to define one ListView in your main.xml nothing else.
它将在左侧创建带有chekcbox和标签的列表,并且在您需要在main.xml中定义一个ListView的额外工作的名称上没有别的。
I hope it will help. 我希望它会有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.