如何在Android中将CheckBox对准其描述的顶部 [英] How to align CheckBox to the top of its description in Android
本文介绍了如何在Android中将CheckBox对准其描述的顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将CheckBox
符号"对准其说明的顶部.
I would like to align CheckBox
"symbol" to the top of its description.
我现在所拥有的:
我想要拥有的东西:
What I want to have:
当前xml:
<CheckBox android:id="@+id/register_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/register_hint"/>
我试图通过操纵layout_gravity
属性来实现这一点,但是它不起作用.
I've tried to achieve this by manipulating layout_gravity
attributes, but it doesn't work.
推荐答案
android:gravity="top"
将解决问题:
<CheckBox android:id="@+id/register_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/register_hint"
android:gravity="top"/>
请注意,android:gravity
与android:layout_gravity
不同.
这篇关于如何在Android中将CheckBox对准其描述的顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文