写一个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

更多相关文章

  1. android 调用 react-native方法
  2. android 调用相机拍照 并缩放切割图片
  3. 查看 apk 的信息
  4. 如何在Activity调用surfaceView实现透明或半透明的效果
  5. Android(安卓)Window系列(一)- window与decorview
  6. android之调用webservice 实现图片上传
  7. 利用html5开发android(转载)
  8. Android面试题整理--1
  9. Android(安卓)AsyncTask

随机推荐

  1. Android中获取网页表单中的数据
  2. android binder机制之--(我是binder)
  3. Android之手机屏幕朝向
  4. android 2.2+ 完全退出程序的方法
  5. Android(安卓)横屏时禁止输入法全屏
  6. android调用系统打电话功能
  7. Android实现画虚线的控件
  8. android CTS SELinuxDomainTest# testIni
  9. android wegit 组件
  10. androidのview游戏框架