【发布时间】:2012-07-27 10:44:42
【问题描述】:
这是我的自定义列表视图的行。如您所见,共有三个 imageView。我应该如何覆盖
public View getView(int position, View convertView, ViewGroup parent)
我的适配器类,这样,我可以设置 imageView.setImageResource,无论我的列表中有多少图像视图。非常感谢任何帮助。
<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>
【问题讨论】:
-
我想你也上过Holder-Class,现在你必须设置那个Holder-Class的图像资源。
-
看到这个example
标签: android android-layout android-intent android-emulator