【发布时间】:2015-02-18 14:23:40
【问题描述】:
我想制作一个从数组列表中获取数据的列表视图。 这是单行的例子
该复选框默认禁用,仅在 longitemclicklistener 中激活(用于多次删除)。
最后一张图片是一个菜单按钮,用于打开删除、共享等菜单列表。
我有一个包含 100 个数字(字符串)的数组列表(myList),对于每个存储的名称,我想根据特定条件显示/隐藏图像
我有这一行:
行.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<CheckBox
android:layout_width="45dp"
android:layout_height="wrap_content"
android:text=" "
android:id="@+id/checkBox"
android:checked="false" />
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/im_buho"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text=" TEXTVIEW"
android:id="@+id/textView"
android:layout_weight="0.66" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/imageView"
android:src="@android:drawable/ic_menu_add"/>
</LinearLayout>
这是activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
我该怎么做?
我不知道如何制作我的自定义适配器。使用 simplearrayadapter 很容易,但我不能使用自定义行。有什么帮助吗? 亲吻,塔季扬娜。对不起我的英语^^
【问题讨论】:
标签: java android listview arraylist