我正在尝试在 android 中创建空行。这就是我一直在做的事情:
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="\n\n"
我想知道是否有更好的方法?谢谢
Use Space
or View
添加特定量的空间。对于 30 个垂直密度像素:
<Space
android:layout_width="1dp"
android:layout_height="30dp"/>
如果您需要灵活的空间填充物,请使用View
a 中的项目之间LinearLayout
:
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
or
<View
android:layout_width="1dp"
android:layout_height="0dp"
android:layout_weight="1"/>
这适用于 API 14 及更高版本的大多数布局,小部件除外(使用FrameLayout
反而)。
[已于 9/2014 更新以使用空间。向@Sean致敬]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)