如何让ListView的使用复选框和图像? [英] How to make ListView with CheckBox and Image?
本文介绍了如何让ListView的使用复选框和图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我现在用这个code为我的ListView简单:
I use this code for my simple ListView now:
final ListView lv = (ListView)findViewById(R.id.apps_list);
lv.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, myString.split("\n")));
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
}
});
和布局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
style="?android:attr/listSeparatorTextViewStyle"
android:id="@+id/separator_apps"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/apps" />
<ListView
android:id="@+id/apps_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_below="@+id/separator_apps" >
</ListView>
</RelativeLayout>
但我需要的图像和CheckBox每一行添加到:此的ListView,可能有人给我一个很好的例子吗?
But I need to add Image and CheckBox to every row to THIS ListView, could someone give me a good example?
推荐答案
发现这个伟大的教程。尝试这
Found this great tutorial. Try this
这篇关于如何让ListView的使用复选框和图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文