`

Android ArrayAdapter的使用

阅读更多

写一个XML用于显示ListView

list1.xml

<?xml version="1.0" encoding="utf-8"?>

<TextView

   xmlns:android="http://schemas.android.com/apk/res/android"

   android:id="@+id/checklv1"

   android:layout_width="fill_parent"

   android:layout_height="fill_parent"

  />

 在主程序里定义一个 private String[] array1= { "aaa","bbb","ccc","ddd" };

然后调用

private ListView lv1;

lv1 = (ListView) findViewById(R.id.lv1);

ArrayAdapter adapter1=new ArrayAdapter (showinfo.this,R.layout.list1,array1);

lv1.setAdapter(adapter1);

lv1为在界面里的一个ListView的widget

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/Zengyangtech/archive/2010/05/04/5554983.aspx

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics