【发布时间】:2012-05-01 12:09:39
【问题描述】:
我有一个 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
android:layout_height="wrap_content"? -
如果您的列表项将仅由一个视图表示,则还要去掉
RelativeLayout。
标签: android imageview padding margin