在Activity里显示列表(ListView的布局)
新建一个继承Activity类的ListViewActivity,并设置布局文件为:listview.xml。
在布局文件中添加一个ListView即可。
<ListView android:id="@+id/listview_lv" android:layout_width="fill_parent" android:layout_height="fill_parent" android:choiceMode="multipleChoice" /> |
在Activity代码中设置即可。
package lyx.feng.second; ...... public class ListViewActivity extends Activity { // 定义组件 private ListView lv = null; // |