listview中的Android布局结构

时间:2014-02-07 08:04:56

标签: android listview layout imageview relativelayout

我有一个listView,其中每行我都有如下结构:enter image description here当我尝试使用margin时,我的图像会回到相对布局。实现这种类型结构的方法是什么。我用其他任何布局?什么是这种结构的有效方式?

1 个答案:

答案 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>

尺寸和可绘制是相对于我的项目,但想法是相同的。