今天在开发Android小应用的时候,使用到了ListView,在使用自己创建的listview风格的时候,就出现了如标题的错误提示信息,这个就让我纳闷了,以前也不会出现这个问题啊,而且也可以运行,赶紧查资料找原因,原来是我的主Activity继承了ListActivity,而ListActivity中必须有一个ListView,因为ListActivity启动时会默认去寻找这个ListView的id,如果没有找到,就会报错。

解决的方法很简单,就是在主Activity布局文件中加个ListView,且ID为list

代码如下:

 <ListView
android:id="@id/android:list"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</ListView>

使用ListView 时,遇到了 Your content must have a ListView whose id attribute is 'android.R.id.list' 错误的更多相关文章

  1. 初学时遇到的小问题Your content must have a ListView whose id attribute is 'android.R.id.list'

    问题提出 错误提示:Your content must have a ListView whose id attribute is 'android.R.id.list' 关于解决Your conte ...

  2. Andriod学习笔记2:“Your content must have a ListView whose id attribute is 'android.R.id.list'”问题的解决办法

    问题描述 activity_main.xml代码如下: <?xml version="1.0" encoding="utf-8"?> <Lin ...

  3. Android Your content must have a ListView whose id attribute is 'android.R.id.list'错误的解决办法

    在Android开发中,ListView有着很重要的地位,使用的场合也非常的多 错误提示:Your content must have a ListView whose id attribute is ...

  4. Your content must have a ListView whose id attribute is 'android.R.id.list'

    修改ListView的ID为 ' @android:id/list ' <ListView android:id="@android:id/list" android:lay ...

  5. Android UI学习 - ListView (android.R.layout.simple_list_item_1是个什么东西)

    Android UI学习 - ListView -- :: 标签:Android UI 移动开发 ListView ListActivity 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始 ...

  6. ibatis动态sql配置启动时提示:The content of elements must consist of well-formed character data...

    ibatis动态sql配置启动时提示:The content of elements must consist of well-formed character data... 2012-07-18 ...

  7. 使用ListView时遇到的问题

    这周练习ListView时遇到了一个问题,从数据库中查询出的数据绑定到LIstView上,长按某个item进行删除操作,每次点击item取得的id都不对,调了半天终于找到了原因,关键是自己对自定义的B ...

  8. 滚动ListView时图像顺序混乱

    本文选自StackOverflow(简称:SOF)精选问答汇总系列文章之一,本系列文章将为读者分享国外最优质的精彩问与答,供读者学习和了解国外最新技术.本文将为读者讲解滚动ListView时图像顺序混 ...

  9. ScrollView中嵌套ListView时,listview高度显示的问题

    方法一:直接更改listview的控件高度,动态获取(根据条目和每个条目的高度获取) 前几天因为项目的需要,要在一个ListView中放入另一个ListView,也即在一个ListView的每个Lis ...

随机推荐

  1. poj 3667 Hotel

    昨天学习了线段树的延迟标记: 发现自己还有区间合并没有学: 抓紧时间学习一下: 代码: #include<cstdio> #include<algorithm> #define ...

  2. 【Tools】maven安装

    安装Maven插件老是报以下的错误,好像少了一个叫guava库的东西,但是在其他机器安装不报这个错误. Cannot complete the install because one or more  ...

  3. Jamie's Contact Groups

    poj2289:http://poj.org/problem?id=2289 题意:给定一个规模为n的名单,要将名单中的人归到m个组中,给出每个人可能的分组号,需要确定一种分配方案,是的最大规模的组最 ...

  4. 【UVALive - 5131】Chips Challenge(上下界循环费用流)

    Description A prominent microprocessor company has enlisted your help to lay out some interchangeabl ...

  5. android实现json数据的解析和把数据转换成json格式的字符串

    利用android sdk里面的 JSONObject和JSONArray把集合或者普通数据,转换成json格式的字符串 JSONObject和JSONArray解析json格式的字符串为集合或者一般 ...

  6. 【HDOJ】1556 Color the ball

    简单线段树. #include <stdio.h> #define MAXN 100005 #define lson l, mid, rt<<1 #define rson mi ...

  7. Linux学习笔记24——进程管道

    一 管道的作用 通常把一个进程的输出通过管道连接到另一个进程的输入. 二 popen和pclose函数 #include <stdio.h> FILE *popen(const char ...

  8. Bzoj 2818: Gcd 莫比乌斯,分块,欧拉函数,线性筛

    2818: Gcd Time Limit: 10 Sec  Memory Limit: 256 MBSubmit: 3241  Solved: 1437[Submit][Status][Discuss ...

  9. Hibernate 以流的方式获取数据

    hibernateQuery.setFetchSize(Integer.MIN_VALUE); results = hibernateQuery.scroll(ScrollMode.FORWARD_O ...

  10. 自己生成非官方iPhone toolchain的头文件

    如果你已经搭建好非官方iPhone toolchain开发包,如果缺少某些头文件,可以用以下方法自己生成. 首先下载class-dump: http://www.codethecode.com/pro ...