Android使用TabHost时报错Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'

£可爱£侵袭症+ 提交于 2019-11-28 22:03:09

使用TabHost提示 Your content must have a TabHost whose id attribute is ‘android.R.id.tabhost’ 或者 Your TabHost must have a TabWidget whose id attribute is ‘android.R.id.tabs’ 等错误信息时。

  1. 改下TabHost的id。使用android:id="@android:id/tabhost",不要使用android:id="@+id/tabhost"
  2. 给TabWidget加id。android:id="@android:id/tabs"
  3. 给FrameLayout加上id。android:id="@android:id/tabcontent"
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!