我有一个 RelativeLayout
用于 ListView
中的一行。该行看起来像,
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="wrap_content"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/placeDetailIcon_Img"
android:layout_height="50dp"
android:layout_width="50dp"
android:layout_alignParentLeft="true"
android:paddingBottom="20dp"
android:paddingTop="20dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"/>
</RelativeLayout>
我也用margin试了一下:
<ImageView
android:layout_height="50dp"
android:layout_width="50dp"
android:id="@+id/placeDetailIcon_Img"
android:layout_alignParentLeft="true"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp">
既不在 ImageView
周围应用边距或填充。如何创建这种类型的间距?
最佳答案
你可以在我的工作中使用它:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/imageView1"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="15dp" />
</RelativeLayout>
希望这对您有所帮助。
关于android - 底部边距或填充在 android 上的 xml 中的相对布局中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10237210/