Your content must have a ExpandableListView whose id attribute is 'android.R.id.

嫣如舜华 2015-07-29 10:51:15
xml:
     <ExpandableListView
android:id="@+id/exListView"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ExpandableListView>


运行到
setContentView(R.layout.main);
总报错:Your content must have a ExpandableListView whose id attribute is 'android.R.id.
...全文
116 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
super小靖 2015-07-30
  • 打赏
  • 举报
回复
你的activity是不是继承的ExpandableListActivity???如果继承的ExpandableListActivity的话,ExpandableListView的id必须是list 不能是其他的哦
gao_chun 2015-07-30
  • 打赏
  • 举报
回复
引用 4 楼 xinguotiantian 的回复:
[quote=引用 1 楼 sdliubo 的回复:]

     <ExpandableListView
         android:id="@id/android:list"
         android:layout_width="match_parent"
         android:layout_height="wrap_content" >
     </ExpandableListView>
用android:id="@id/android:list"可以了! 但不明白为什么不能用android:id="@+id/exListView"这种自己随便定义的呢?[/quote] 怎么可能,那照这么说,android:id="@+id/exListView" 这么写岂不是不能用了
嫣如舜华 2015-07-30
  • 打赏
  • 举报
回复
引用 1 楼 sdliubo 的回复:

     <ExpandableListView
         android:id="@id/android:list"
         android:layout_width="match_parent"
         android:layout_height="wrap_content" >
     </ExpandableListView>
用android:id="@id/android:list"可以了! 但不明白为什么不能用android:id="@+id/exListView"这种自己随便定义的呢?
嫣如舜华 2015-07-30
  • 打赏
  • 举报
回复
引用 3 楼 gao_chun 的回复:
android:id="@id/android:list" 兄台,这么写编译器能通过吗 ? 改成: android:id="@+id/list"
你这种写法跟我写的没分别的?不行的
sdliubo 2015-07-29
  • 打赏
  • 举报
回复
或是 android:id="@android:id/list"
sdliubo 2015-07-29
  • 打赏
  • 举报
回复

     <ExpandableListView
         android:id="@id/android:list"
         android:layout_width="match_parent"
         android:layout_height="wrap_content" >
     </ExpandableListView>
gao_chun 2015-07-29
  • 打赏
  • 举报
回复
android:id="@id/android:list" 兄台,这么写编译器能通过吗 ? 改成: android:id="@+id/list"

80,350

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧