您的位置:首页 > 移动开发 > Android开发

Android LineaerLayout中layout_margin失效不起作用的解决方法

2012-07-12 20:13 423 查看
<LinearLayout
android:id="@+id/main"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:orientation="vertical">

上面这种做法在某些Android版本放到scrollview或者RelativeLayou里面的话,layout_margin会失效,不起作用!

网上没找到相关解决方案,只能自己摸索,设置各种属性,最后终于解决:

在属性里面加入android:layout_gravity="top",问题就解决了,我觉得这个是android的一个bug。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android layout