开发者

Android CheckBox with right-aligned checking button/box

开发者 https://www.devze.com 2022-12-20 16:14 出处:网络
I am f开发者_开发问答airly 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 rig

I am f开发者_开发问答airly 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,


Try CheckedTextView, which is the widget used by multiple-choice ListView widgets.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消