底部边距或填充在android上的xml中的相对布局中不起作用
问题描述:
我在 ListView
内的行中有 RelativeLayout
。该行看起来像,
I have a RelativeLayout
for a row that goes inside a ListView
. The row looks like,
<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>
我也尝试过保证金:
<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
周围应用保证金或填充>。如何创建这种类型的间距?
Neither apply the margin or padding around the ImageView
. How do create this type of spacing?
答
你可以将它与我一起使用:
you can use this its work with me :
<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>
希望这会有所帮助。