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

使用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"
上一篇:3441:4 Values whose Sum is 0(二分查找)


下一篇:二分-G - 4 Values whose Sum is 0