我有一个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} –