我想将 Android 中的一组复选框对齐在屏幕中央并位于与单选按钮组类似的同一垂直线上。我在 Internet 上搜索但没有看到任何解决方案。
比如我有一份问卷“你为什么来这家店”,有四个答案1.位置2.服务3.设施4.以上都是。用户可以选择多个答案。
如果我使用单选按钮,我只是将它们分组到一个单选组中。我不知道如何处理复选框。或者我需要使用其他表单小部件。
已编辑
类似于这张图片 https://docs.google.com/file/d/0B9xpIwq2ZRYfQUtYM3RmYVU5VTA/edit
最佳答案
一种方法是将它们全部放在一个LinearLayout
中,并给它们每个相同的android:layout_margin Right
:
<LinearLayout
android:id="@+id/foo"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="5dip">
<CheckBox
android:id="@+id/bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dip"
android:text="this is a checkbox"
android:textColor="@color/Black"
android:checked="false" />
</LinearLayout>
关于Android 在同一垂直线上对齐复选框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25609603/