[代码]main.xml  

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:Android="http://schemas.android.com/apk/res/android"
Android:orientation="vertical" android:layout_width="fill_parent" Android:layout_height="fill_parent">
<!-- 注意这里的Android:id是使用内置的-->
<ListView Android:id="@android:id/list "
Android:layout_width="fill_parent"
Android:layout_height="wrap_content"></ListView> </LinearLayout>

[代码][Java]代码  

protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String[]items ={"aaa","bbbb","cccc"};
ArrayAdapter arrayAdapter = new ArrayAdapter(this,Android.R.layout.simple_list_item_1 ,items);
setListAdapter(arrayAdapter); }

原文详细:http://android.662p.com/thread-493-1-1.html

怎样在Android中ListView与ArrayAdapter配合使用的更多相关文章

  1. Android中Listview点击item不变颜色以及设置listselector 无效

    Android中Listview点击item不变颜色以及设置listselector 无效 这是同一个问题,Listview中点击item是会变颜色的,因为listview设置了默认的listsele ...

  2. Android中ListView控件的使用

    Android中ListView控件的使用 ListView展示数据的原理 在Android中,其实ListView就相当于web中的jsp,Adapter是适配器,它就相当于web中的Servlet ...

  3. android中ListView控件&&onItemClick事件中获取listView传递的数据

    http://blog.csdn.net/aben_2005/article/details/6592205 本文转载自:android中ListView控件&&onItemClick ...

  4. android中ListView点击和里边按钮点击不能同时生效问题解决

    今天遇到一个问题:android中ListView点击和里边button点击不能同时生效问题解决. 原因是: listView 在开始绘制的时候,系统首先调用getCount()函数,根据他的返回值得 ...

  5. Android中ListView无法点击

    Android中ListView无法点击 转自:http://xqjay19910131-yahoo-cn.iteye.com/blog/1319502   问题描述: ListView中Item加入 ...

  6. android 中 listview 设置自动匹配高度

    1.布局文件 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:l ...

  7. Android中 ListView 详解(二)

    本文版权归 csdn noTice501 所有,转载请详细标明原作者及出处,以示尊重! 作者:noTice501 原文:http://blog.csdn.net/notice520/article/d ...

  8. Android(java)学习笔记137:Android中SimpleAdapter,ArrayAdapter和BaseAdapter常见的适配器

    1.SimpleAdapter(BaseAdapter子类扩展类): simpleAdapter的扩展性最好,可以定义各种各样的布局出来,可以放上ImageView(图片)等.可以显示比较复杂的列表, ...

  9. Android(java)学习笔记79:Android中SimpleAdapter,ArrayAdapter和BaseAdapter常见的适配器

    1. SimpleAdapter(BaseAdapter子类扩展类): simpleAdapter的扩展性最好,可以定义各种各样的布局出来,可以放上ImageView(图片)等.可以显示比较复杂的列表 ...

随机推荐

  1. ethereal抓包工具

    ethereal是目前网络上开源的一款功能强大的以太网抓包工具,该软件可以监听异常封包,检测软件封包问题,从网络上抓包,并且能对数据包进行分析,从而帮助用户解决各种网络故障,更加方便查看.监控TCP ...

  2. 四步轻松实现用Visio画UML类图

    本节和大家一起学习一下用Visio画UML类图的方法,主要有四个步骤,这里和大家分享一下,相信通过本节的学习,你对Visio画UML类图的步骤一定会有所了解. 用Visio画UML类图 对于画类图的工 ...

  3. [ActionScript 3.0] AS3 获取某年某月的天数(Get number of days in a month)

    function getNumberOfDays($year:int, $month:int):int { var month:Date = new Date($year, $month + 1, 0 ...

  4. Oracle中的单行函数

    Oracle中的单行函数 1 字符函数 UPPER()--将字符串转换为大写 SELECT UPPER('abc') FROM dual; LOWER()-将字符串转换为小写 SELECT LOWER ...

  5. data-icon=""图片还可以是自定义的?

    自定义的图片怎么写啊? data-icon = "地址" 不对啊????? 不是写地址,而是设置css 比如 data-icon="mm" 那么在css中肯定有 ...

  6. js替换字符串中全部“-”

    alert("2014-03-22".replace('-','')); alert("2014-03-22".replace(/-/g,'')); 第一个运行 ...

  7. 配置Tomcat数据源

    1.方式一:在server.xml中配置 1)tomcat安装路径下conf目录下的server.xml,在<GlobalNamingResources>和</GlobalNamin ...

  8. 共享有线实现手机上网,然后使用charles来抓包

    问题描述:共享有线实现手机上网(http://support1.lenovo.com.cn/lenovo/wsi/htmls/detail_1323385217890211.html)  [建议] 还 ...

  9. 《Code Complete》ch.15 使用条件语句

    WHAT? 条件语句指if.else.case.switch,循环语句指for.while WHY? 不用条件语句你写得出代码吗? HOW? if-then 正常情况放在异常情况之前 执行频率高的情况 ...

  10. JAVA的JDBC连接与sql操作

    一.前言 本文主要介绍怎样连接数据库.即JDBC的操作.以MySQL为例子. 前提是首先要将驱动jar包放入对应路径中. 二.过程说明 1.加载jdbc驱动程序 <span style=&quo ...