开发者

setting up icons for a list

I have an app in android that in some activity it displays using a item list the content from a column from the DB.

this is the way I'm doing it:

lv = (ListView) findViewById(R.id.list);

    Cursor cursor = db.getAllData();
        startManagingCursor(cursor);

        adapter = new SimpleCursorAdapter(this, R.layout.listitem, cursor,
                new String[] { db.KEY_USER }, new int[] { R.id.txt1 });
        lv.setAdapter(a开发者_如何学JAVAdapter);

I'm using an adapter to connect the text view and the content of the table.

Here is how my Xml looks like"

<?xml version="1.0" encoding="utf-8"?>  
<TextView 
  xmlns:android="http://schemas.android.com/apk/res/android" 
  android:layout_width="fill_parent" 
  android:layout_height="wrap_content" 
  android:id="@+id/txt1"
  android:textSize="20dip" 
  android:padding="8dip" /> 

My question is:

How could I setup icons and colour for every list item that comes connected with my data from DB?


You might want to consider using android.app.ListActivity. With a list activity you can provide an xml layout to create advanced visuals for your items.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜