我有一個tabhost,其中包含三個製表符,並與三個活動相關聯。所有三個標籤都位於上方。我怎樣才能使這三個標籤在底部?如何在底部添加製表符
我發現這個,但仍然有一些問題。
這是我tabhost XML文件:
<?xml version="1.0" encoding="UTF-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" />
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0"/>
</LinearLayout>
</TabHost>
在我TabActivity類,我有以下代碼:
setContentView(R.layout.tabs);
TabHost mTabHost = (TabHost)findViewById(android.R.id.tabhost);
mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator("TAB 1").setContent(new Intent(AndroisTabViewActivity.this,TabActivity1.class)));
mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator("TAB 2").setContent(new Intent(AndroisTabViewActivity.this,TabActivity1.class)));
mTabHost.addTab(mTabHost.newTabSpec("tab_test3").setIndicator("TAB 3").setContent(new Intent(AndroisTabViewActivity.this,TabActivity1.class)));
mTabHost.setCurrentTab(0);
有一個名爲TabActivity1一個活動,我也包括在清單文件。但它顯示的錯誤:
Can't get the activity TabActivity1.
您是否在Manifest文件中包含了AndroisTabViewActivity?請說明您收到了哪種錯誤。也許它甚至與註冊清單中的活動無關。 – Kostas
是的,我把它包含在清單文件中。我不知道如何讓你的日誌貓圖片。所以我會寫錯誤。只需等待。 –
這裏是我的錯誤:無法啓動activityComponentInfo {com.mirza.tabViewDemo/com.mirza.tabViewDemo.AndroisTabViewActivity}:android.content.ActivityNotFoundException顯式活動類{com.mirza.tabViewDemo/com.mirza.tabViewDemo.TabActivity1} –