添加空格布局 [英] Adding blank spaces to layout
本文介绍了添加空格布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图让内Android的空行。这是我一直在做的:
I am trying to make empty lines within android. This is what I have been doing:
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="\n\n"
我想知道是否有更好的办法?谢谢
I want to know if there is a better way? Thanks
推荐答案
使用空间或视图中添加一个空格具体金额。对于30垂直密度像素:
Use Space or View to add a specific amount of space. For 30 vertical density pixels:
<Space
android:layout_width="1dp"
android:layout_height="30dp"/>
如果你需要一个灵活的空间填料,在LinearLayout中使用的物品之间的观点:
If you need a flexible space-filler, use View between items in a LinearLayout:
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
或
<View
android:layout_width="1dp"
android:layout_height="0dp"
android:layout_weight="1"/>
这适用于大多数布局API 14安培;后来,除了小部件(使用的FrameLayout代替)。
This works for most layouts for API 14 & later, except widgets (use FrameLayout instead).
[更新二千零一十四分之九使用空间。帽尖到@Sean]
[Updated 9/2014 to use Space. Hat tip to @Sean]
这篇关于添加空格布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文