[代码]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. IronPython 设置包路径

    C#中添加对python文件或者对python包的引用时出现"no module .."的问题时的解决办法. 对hello.py 做一些简单的修改 添加 import syssys ...

  2. chkconfig : No such file or directory

    sys_version:12.04LTS For example: #chkconfig --level mysql on /sbin/insserv:No such file or director ...

  3. 把Nginx加为系统服务(service nginx start/stop/restart)

    1.编写脚本,名为nginx #!/bin/sh # # nginx - this script starts and stops the nginx daemon # # chkconfig: - ...

  4. [ActionScript 3.0] AS3.0 获取像素点的灰度

    /** * 获取像素点的灰度 * @color 像素点的颜色值 * @return uint */ function getGray(color:uint):uint { return getR(co ...

  5. 使用jaxp对比xml进行DOM解析

    /*DOM解析编程 •遍历所有节点 •查找某一个节点 •删除结点 •更新结点 •添加节点 /* package cn.itcast.jaxp; import java.io.File; import ...

  6. 蓝桥杯--- 历届试题 大臣的旅费 (DFS & Vector)

    题目提交链接:http://lx.lanqiao.org/problem.page?gpid=T32 问题描述 很久以前,T王国空前繁荣.为了更好地管理国家,王国修建了大量的快速路,用于连接首都和王国 ...

  7. Problem 2195 检查站点(普通树构造)(Vector)

    Time Limit: 1000 mSec    Memory Limit : 32768 KB Problem Description 在山上一共有N个站点需要检查,检查员从山顶出发去各个站点进行检 ...

  8. make menuconfig 是一个目录。停止 错误解决

    在移植Linux内核时候,发现用 make menuconfig  发生如下错误 linux@ubuntu:/work/linux-socfpga$ make menuconfig make: *** ...

  9. Redis集群搭建&访问

    集群搭建步骤 1.创建多个节点: 2.为每个节点指派槽,并将多个节点连接起来,组成一个集群: 3.当集群数据库的16384个槽都有节点在处理时,集群进入上线状态: 要求:搭建一个包含6个节点的Redi ...

  10. python 如何找到某一目录下的文件类型(三种方法)

    #!/usr/bin/env python import glob import os os.chdir(“./”) for file in glob.glob(“*.py”): print file ...