這是我的自定義列表視圖的一行。正如你所看到的,有三個imageViews。我應該如何重寫如何通過getview爲多個imageView設置圖像資源
public View getView(int position, View convertView, ViewGroup parent)
,這樣,我可以設置imageView.setImageResource,不管我有多少imageviews在我的名單。任何幫助深表感謝。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:id="@+id/LinearLayout01"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginRight="10px" />
<ImageView
android:id="@+id/image1"
android:layout_toRightOf= "@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10px" />
<ImageView
android:id="@+id/image2"
android:layout_toRightOf= "@+id/image1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10px" />
</RelativeLayout>
</LinearLayout>
我想你也有被持有者級,現在你有設置該持有人類別的圖像資源。 – 2012-07-27 10:49:31
看到這個[示例](http://android-example-code.blogspot.in/p/dynamic-custoized-list-view-in-android.html) – MAC 2012-07-27 10:50:08