【发布时间】:2016-12-18 20:21:44
【问题描述】:
我正在尝试创建适配器以在一个列表视图中显示 2 个列表。列表应按图像划分。这就是 XML 的思想。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<TextView
android:id="@+id/Itemname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:layout_gravity="left"
android:paddingTop="5dp"/>
<ImageView
android:id="@+id/icon"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_gravity="center"
android:src="@mipmap/ic_launcher" />
<TextView
android:id="@+id/Itemname2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:layout_gravity="right"
android:paddingTop="5dp"/>
我发现编写自定义适配器很复杂,因此欢迎提供任何帮助。
【问题讨论】:
-
为什么不简单地使用 2 个 ListViews 和一个 ImageView 之间?
标签: android listview arraylist android-arrayadapter