如何让ListView的使用复选框和图像?复选框、图像、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我现在用这个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

阅读全文

相关推荐

最新文章