Java android中的选项卡不显示
我已经为这个话题搜索了很多,但至少我必须在这里问它,因为我知道我会得到正确的答案。我想在我的xml页面中有三个选项卡,但只有“选项卡标签”写在上面。这是我的主要xml文件:Java android中的选项卡不显示,java,android,xml,Java,Android,Xml,我已经为这个话题搜索了很多,但至少我必须在这里问它,因为我知道我会得到正确的答案。我想在我的xml页面中有三个选项卡,但只有“选项卡标签”写在上面。这是我的主要xml文件: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_par
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TabHost
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
</LinearLayout>
</TabHost>
请帮助我。从这里开始尝试:检查选项卡图标是否正常工作?
package com.example.hi_5physics;
import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;
@SuppressWarnings("deprecation")
public class Astronomytab extends TabActivity {
private TabHost mTabHost;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.astronomy);
mTabHost = getTabHost();
mTabHost.setup();
Intent intentAndroid1 = new Intent().setClass(this, Faqs.class);
TabHost.TabSpec tab1 = mTabHost
.newTabSpec("Android")
.setIndicator("Rankings")
.setContent(intentAndroid1);
Intent intentAndroid2 = new Intent().setClass(this, Contactus.class);
TabHost.TabSpec tab2 = mTabHost
.newTabSpec("Android")
.setIndicator("My Team")
.setContent(intentAndroid2);
mTabHost.addTab(tab1);
mTabHost.addTab(tab2);
}}