关于解决Your content must have a ListView whose id attribute is ‘android.R.id.list’的问题:
很可能是因为我们要实现对ListView中setOnItemClick的事件监听而去继承了LiseActivity,但是却没有ListView的标签,解决问题方法很简单:
ListView的id设置为“@android:id/list”或android:id=”@id/android:list”
用getListView来获取ListView的对象了。
在开发的过程中还会遇到类似的问题比如:TabHost
错误信息为:Your content must have a TabHost whose id attribute is ‘android.R.id.tabhost’
添加android:id=”@android:id/tabhost”, 这样就可以了。
还会遇到这样一个错误描述:Your TabHost must have a TabWidget whose id attribute is ‘android.R.id.tabcontent’
同样解决方法为:修改FrameLayout添加id属性
格式android:id=”@android:id/tabcontent

完整的参考一下:

<?xml version=”1.0″ encoding=”utf-8″?><TabHostandroid:id=”@android:id/tabhostxmlns:android=”http://schemas.android.com/apk/res/androidandroid:layout_width=”fill_parent” android:layout_height=”fill_parent”><LinearLayout android:id=”@+id/userandroid:layout_height=”fill_parent”android:layout_width=”fill_parent” android:orientation=”vertical”><TabWidget android:id=”@android:id/tabsandroid:layout_height=”wrap_content”android:layout_width=”fill_parent”>TabWidget><FrameLayout android:id=”@android:id/tabcontentandroid:layout_width=”fill_parent”android:layout_height=”fill_parent”>FrameLayout>LinearLayout>TabHost>

注意:一个工程中只能有一个TabHost。

更多相关文章

  1. 有关Android中EditText的一些属性
  2. Android自定义属性,format详解
  3. Android 错误 :TextView中属性ellipsize的 值为start、middle可能
  4. android实现Parcelable序列化对象
  5. Android Intent传递对象和集合
  6. android中的一个属性动画,可以显示更多的一个案例
  7. RelativeLayoutd 的属性
  8. android intent 传递对象需要序列化实现Parcelable接口
  9. Android 属性动画中心点无限循环

随机推荐

  1. Android(安卓)monkey test 脚本的编写
  2. Android的Widget
  3. JKS密匙库专用格式,建议使用“keytool -im
  4. android发现之旅之媒体按键(耳机按键播放
  5. Android(安卓)开发常用开源库
  6. Android(安卓)开机启动流程分析
  7. Android(安卓)Studio 首次创建工程下载Gr
  8. 迅雷快速下载 Android(安卓)SDK相关
  9. android 几个阶段
  10. Android在全球的市场份额跃居全球第一