How to Set the Checkbox on the right side of the text [duplicate]

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-18 03:48:39

问题


Possible Duplicate:
How to show android checkbox at right side?

In my android application, I have a checkbox and some text associate with it. By default the texts are in the right side and the checkbox in left side. But I want to put the checkbox on the right side. Help me please.


回答1:


I dont know whether it is possible or not by styling ,

But here is a solution for you

Use "" as the value of the CheckBox ,then add a TextView to the left of the CheckBox with your desired text.




回答2:


Very easy. Do it in an elegant way:

  1. Create your own checkbox button. It includes a checked and unchecked state.
  2. Edit your layout file, for checkbox node:
    1. Set android:button="@null"
    2. Set android:drawableRight="@drawable/YOUR_CHECKBOX_BUTTON"

Perfectly solve your problem.

If you want to put the text under your button, set android:drawableTop.




回答3:


You can do so by:

  1. taking a linear layout.
  2. Put it's orientation to horizontal.
  3. Then put a text view and then a check box.
  4. Put the same text in the text view that you wanted to associate with the check box.

Thanks.



来源:https://stackoverflow.com/questions/5000213/how-to-set-the-checkbox-on-the-right-side-of-the-text

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!