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

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/weixin_43219615/article/details/100134432

使用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"

猜你喜欢

转载自blog.csdn.net/weixin_43219615/article/details/100134432
今日推荐