简体   繁体   中英

Android CheckBox with right-aligned checking button/box

I am fairly new to Android (find it most fun, btw) and I was wondering...

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)? 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...

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. You can use *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.

I hope it will help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM