0

我有http://developer.android.com/resources/tutorials/views/hello-listview.html教程,我想在另一个课程中做同样的事情。我不想在活动课上这样做!!!

4

2 回答 2

0

//you need to extends the Activity

and in your onCreate() method

you need to get the ListView id

ListView myListview=(ListView)findViewbyId(R.id.mylist);
myListview.setAdapter(...);
于 2012-06-04T15:39:37.320 回答
0

Lunch from an Activity your list view after getting reference to your listview widget by

ListView myListview=(ListView)findViewbyId(R.id.mylist);

in your layout after that bind data to your list view using Adapter by calling

myListview.setAdapter();

see this tutorial

enter image description here

and this one is a custom list view with icon

enter image description here

于 2012-06-04T15:40:23.983 回答