android-Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'

試著忘記壹切 提交于 2019-12-13 18:54:13

问题


Hi i created one customised tab bar with three tabs. I loaded one tab with google link, another with the small hello world app and another with the layout which has design for different screen resolutions. When i tap on the third tab it is showing an error "Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'". But it is not showing that error when i load the third tab with small app. Why is it happening like that? Can any one help me?

Error:

12-08 11:50:52.004: ERROR/ACRA(1738): El Gifto fatal error : Unable to start activity ComponentInfo{com.ibkr.elgifto/com.ibkr.elgifto.Ehome}: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'
12-08 11:50:52.004: ERROR/ACRA(1738): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ibkr.elgifto/com.ibkr.elgifto.Ehome}: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'
12-08 11:50:52.004: ERROR/ACRA(1738): Caused by: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'
12-08 11:50:52.004: ERROR/ACRA(1738):     at android.app.TabActivity.onContentChanged(TabActivity.java:105)
12-08 11:50:52.004: ERROR/ACRA(1738):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:210)
12-08 11:50:52.004: ERROR/ACRA(1738):     at android.app.Activity.setContentView(Activity.java:1657)
12-08 11:50:52.004: ERROR/ACRA(1738):     at com.ibkr.elgifto.Ehome.onCreate(Ehome.java:132)

thanks


回答1:


If you are going to use TabActivity, you need to use @android:id/tabhost as the android:id value of your TabHost in your xml layout file



来源:https://stackoverflow.com/questions/8430759/android-your-content-must-have-a-tabhost-whose-id-attribute-is-android-r-id-tab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!