0

I am developing an android application with home page same as facebook app. I have inflated a layout to my home page by using the following code.

View app = inflater.inflate(R.layout.app, null);

I have a tabhost in the layout 'app'. The home page is extending activity. When I run the application the app is throwing error

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

How can I avoid this error?

4

2 に答える 2

1

次のコードを試してください。

TabHost t = getTabHost();
TabSpec tab = t.newTabSpec(label)
               .setIndicator(label, icon)
               .setContent(intent);
t.addTab(tab);  

または、タブホスト ID を次のように変更します

<TabHost android:id="@android:id/tabhost"
于 2013-09-02T10:34:33.440 に答える
0

remove extends TabHost をクラスから削除します。

于 2013-09-02T10:32:54.000 に答える