使用ListView 时,遇到了 Your content must have a ListView whose id attribute is 'android.R.id.list' 错误
今天在开发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' 错误的更多相关文章
- 初学时遇到的小问题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 ...
- 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 ...
- 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 ...
- 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 ...
- Android UI学习 - ListView (android.R.layout.simple_list_item_1是个什么东西)
Android UI学习 - ListView -- :: 标签:Android UI 移动开发 ListView ListActivity 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始 ...
- 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 ...
- 使用ListView时遇到的问题
这周练习ListView时遇到了一个问题,从数据库中查询出的数据绑定到LIstView上,长按某个item进行删除操作,每次点击item取得的id都不对,调了半天终于找到了原因,关键是自己对自定义的B ...
- 滚动ListView时图像顺序混乱
本文选自StackOverflow(简称:SOF)精选问答汇总系列文章之一,本系列文章将为读者分享国外最优质的精彩问与答,供读者学习和了解国外最新技术.本文将为读者讲解滚动ListView时图像顺序混 ...
- ScrollView中嵌套ListView时,listview高度显示的问题
方法一:直接更改listview的控件高度,动态获取(根据条目和每个条目的高度获取) 前几天因为项目的需要,要在一个ListView中放入另一个ListView,也即在一个ListView的每个Lis ...
随机推荐
- 000webhost找不到文件自定义错误
1.新建一个名为.htaccess的文本文件:2.在文件中输入如下代码:ErrorDocument 404 /404.php3.保存文件,将.htaccess上传到域名的根目录,再验证,呵呵,成功了! ...
- matlab的cell数组
matlab的cell数组 元胞数组: 元胞数组是MATLAB的一种特殊数据类型,可以将元胞数组看做一种无所不包的通用矩阵,或者叫做广义矩阵.组成元胞数组的元素可以是任何一种数据类型的常数或者常量,每 ...
- Spring MVC 解读——<mvc:annotation-driven/>(转)
转自:http://my.oschina.net/HeliosFly/blog/205343 Spring MVC 解读——<mvc:annotation-driven/> 一.Annot ...
- asp.net中水印的实现代码
水印是为了防止别盗用我们的图片. 两种方式实现水印效果 1)可以在用户上传时添加水印. a) 好处:与2种方法相比,用户每次读取此图片时,服务器直接发送给客户就行了. b) 缺点:破坏了原始图 ...
- group by 替代distinct
SQL> select distinct employee_id,first_name from test1; 107 rows selected. Execution Plan ------- ...
- 【HDOJ】1455 Sticks
DFS.搜索以棍数为条件循环搜索较好,这样不会超时. #include <stdio.h> #include <string.h> #include <stdlib.h& ...
- bzoj2821
其实和bzoj2724是一样的都是先处理多个块的答案,然后多余部分暴力空间要注意一下,还是O(nsqrt(n)); ..,..] of longint; g:..,..] of longint; a, ...
- Linux学习笔记23——取消线程
一 相关函数 1 发送终止信号 #include <pthread.h> int pthread_cancel(pthread_t thread); 2 设置取消状态 #include & ...
- 排序算法简介及其C实现
排序算法(Sorting Algorithm)是计算机算法的一个组成部分. 排序的目标是将一组数据 (即一个序列) 重新排列,排列后的数据符合从大到小 (或者从小到大) 的次序.这是古老但依然富有挑战 ...
- hdu 2546 典型01背包
分析:每种菜仅仅可以购买一次,但是低于5元不可消费,求剩余金额的最小值问题..其实也就是最接近5元(>=5)时, 购买还没有买过的蔡中最大值问题,当然还有一些临界情况 1.当余额充足时,可以随意 ...