开发者

How do I display a two-line list view?

开发者 https://www.devze.com 2023-04-03 14:35 出处:网络
I want a two-line list view in my activity. This code is displaying one column. Here only the Category column displays, but I also want the Distance_from_Centre at r开发者_StackOverflowight side. My

I want a two-line list view in my activity.

This code is displaying one column. Here only the Category column displays, but I also want the Distance_from_Centre at r开发者_StackOverflowight side. My code is:

if (c.moveToFirst()) {
    int i = 0;
    do {
        i++;
        int Category = c.getColumnIndex("Category");
        int Distance_from_Centre = c
                .getColumnIndex("Distance_from_Centre");
        String str;
        String Str1;
        str = c.getString(Category).toString();
        Str1 = c.getString(Distance_from_Centre).toString();
        /* strArr1[i] = c.getString(Category).toString();
        strArr2[i] = c.getString(Distance_from_Centre).toString();*/
        list.add(str);

        Log.i("LOCATION ", str);
        Log.i("I  ", i + "");
    } while (c.moveToNext());
    lv.setAdapter(new ArrayAdapter<String>(this,
            android.R.layout.test_list_item, list));
    // android.R.layout.simple_list_item_1,list));
}


You need to customize your list adapter.


Use android.R.layout.two_line_list_item

0

精彩评论

暂无评论...
验证码 换一张
取 消