我有一个listView,其中每行我都有如下结构:当我尝试使用margin时,我的图像会回到相对布局。实现这种类型结构的方法是什么。我用其他任何布局?什么是这种结构的有效方式?
答案 0 :(得分:2)
试试这个:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="100dip"
android:background="@android:color/white" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="90dip"
android:layout_marginTop="10dip"
android:background="@android:color/black" >
</RelativeLayout>
<ImageView
android:layout_width="30dip"
android:layout_height="30dip"
android:background="@drawable/ic_launcher"
android:layout_marginLeft="10dip" >
</ImageView>
</RelativeLayout>
尺寸和可绘制是相对于我的项目,但想法是相同的。