使用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 ...
随机推荐
- "_OBJC_CLASS_$_WeiboApi", referenced from: objc-class-ref in libtuyoo.a(TuYoo.o)
Undefined symbols for architecture i386: "_OBJC_CLASS_$_WeiboApi", referenced from: objc-c ...
- GConf 错误:联系配置服务器失败;某些可能原因是需要为 ORBit 启用 TCP/IP 联网
http://blog.csdn.net/heirenheiren/article/details/8107294 http://blog.sina.com.cn/s/blog_8097f8aa010 ...
- 翻译qmake文档 目录(四篇)
http://www.cnblogs.com/li-peng/p/4026133.html
- 【HDOJ】1881 毕业bg
01背包. #include <cstdio> #include <cstring> #include <cstdlib> #define MAXN 1005 ty ...
- [LeetCode#12] Roman to Integer
Problem: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range ...
- WordPress HMS Testimonials 多个跨站脚本漏洞和跨站请求伪造漏洞
漏洞名称: WordPress HMS Testimonials 多个跨站脚本漏洞和跨站请求伪造漏洞 CNNVD编号: CNNVD-201308-199 发布时间: 2013-08-22 更新时间: ...
- 导航软件 CH Round #57 - Story of the OI Class
题目:http://ch.ezoj.tk/contest/CH%20Round%20%2357%20-%20Story%20of%20the%20OI%20Class/导航软件 题解:刚开始看见题目, ...
- leetcode实现 “10001”+“1011” 返回二进制相加的结果
https://oj.leetcode.com/problems/add-binary/ 实” 1 public class Solution { public String addBinary(St ...
- ORACLE EXP-00011:表不存在的分析和解决方案
解决方法: ~~看下数据库的延迟段创建参数 SQL> show parameter DEFERRED_SEGMENT_CREATION NAME ...
- disconf实践(一)
公司目前的应用基本采用分布式部署,通过F5进行集群管理.分布式应用带来的好处是,随着流量的增加,可以快速扩展应用节点,分摊压力.分布式也会带来一定的挑战,譬如配置文件管理.如果某个配置要修改,那么所有 ...