2013-06-18 137 views
0

在我的布局中,我需要一个像盒子类型的自定义列表视图。Android自定义列表视图?

该怎么办?

我的XML:

<LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="317dp" 
    android:gravity="top" 
    android:orientation="vertical" 
    android:background="@android:color/transparent" 
    > 

    <ListView android:id="@+id/slistview" 
     android:layout_height="fill_parent" 
     android:layout_width="fill_parent" 
     android:divider="#2867EA" 
     android:dividerHeight="1dp" 
     android:cacheColorHint="#00000000" 
     > 
    </ListView> 

</LinearLayout>  
+5

有一个自定义适配器膨胀的每一行的自定义布局和适配器设置为列表视图。 http://www.androidhive.info/2012/02/android-custom-listview-with-image-and-text/ – Raghunandan

+0

使用像这样的自定义适配器http://abhiandroidinfo.blogspot.in/2013/05/customised- listview-with-images.html – abhi

+0

box type?你可以插入任何图片样本? – deadfish

回答

2

您应该为每一行自定义列表适配器和电源XML布局。 这里有一个全面的教程,适合您的需要:

Link

0

您可以使用customBaseadapterviewHolder ...

+0

为多行listview ..好教程在这里.. [链接] http://vaibhavadhyapak.blogspot.in/2013/01/building-custom-multi-line-listview-in.html – 2013-06-18 09:17:16

0

创建列表视图的行中的XML,并设置行的背景,创造自定义适配器并设置适配器以列出视图。

custom list view