【发布时间】:2012-05-10 06:59:51
【问题描述】:
我有以下布局文件:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#FF0000" >
<RelativeLayout
android:id="@+id/usericon_img"
android:layout_width="73.3334dp"
android:layout_height="70.6667dp"
android:layout_marginBottom="2.6667dp"
android:layout_marginLeft="3.3334dp"
android:layout_marginTop="2.6667dp"
android:background="#FFFFFF" />
</RelativeLayout>
在模拟器上(我在真机上测试过,看起来一样)布局如下:
我的问题是:为什么我在白色布局下没有红色边距?我知道如果我将外部布局更改为:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="76dp"
android:background="#FF0000" >
我会得到我想要的,但为什么wrap_content 不能正常工作?
【问题讨论】:
标签: android margin android-relativelayout