Android 带WebView的选项卡视图

Android 带WebView的选项卡视图,android,webview,tabview,Android,Webview,Tabview,我在一个页面中有3个选项卡,每个选项卡都有一个活动正在调用,但当我们调用活动Web视图时,我的选项卡消失,并且只有Web视图占据了整个页面。请告诉我如何显示选项卡视图,Web视图是我的第三个选项卡。当我使用返回键返回选项卡视图时,它只显示黑屏 MainActivity.java @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setCo

我在一个页面中有3个选项卡,每个选项卡都有一个活动正在调用,但当我们调用活动Web视图时,我的选项卡消失,并且只有Web视图占据了整个页面。请告诉我如何显示选项卡视图,Web视图是我的第三个选项卡。当我使用返回键返回选项卡视图时,它只显示黑屏

MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    TabHost tabHost=getTabHost();
    // no need to call TabHost.Setup()       
    //First Tab
    TabSpec spec1=tabHost.newTabSpec("Tab 1");
    spec1.setIndicator("Registration",getResources().
    getDrawable(R.drawable.ic_launcher));
    Intent in1=new Intent(this,RegistrationActivity.class);
    spec1.setContent(in1);

    TabSpec spec2=tabHost.newTabSpec("Tab 2");
    spec2.setIndicator("Login",getResources().
    getDrawable(R.drawable.ic_launcher));
    Intent in2=new Intent(this,LoginActivity.class);
    spec2.setContent(in2);

    TabSpec spec3=tabHost.newTabSpec("Tab 2");
    spec3.setIndicator("WebView",getResources().
    getDrawable(R.drawable.ic_launcher));
    Intent in3=new Intent(this,WebViewActivity.class);
    spec3.setContent(in3);

    tabHost.addTab(spec1);
    tabHost.addTab(spec2);
    tabHost.addTab(spec3);
}
web视图活动

super.onCreate(savedInstanceState);
setContentView(R.layout.webview);

webView = (WebView) findViewById(R.id.webView1);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("http://www.google.com");
webView.getParent();
主选项卡xml

<?xml version="1.0" encoding="utf-8"?>

<TabHost android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@android:id/tabhost"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical">

        <ScrollView 
            android:layout_width="fill_parent"
            android:layout_height="0dip"
            android:layout_weight="90"> 

            <FrameLayout
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:id="@android:id/tabcontent" />

        </ScrollView> 

        <TabWidget
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:id="@android:id/tabs"/>

    </LinearLayout>
</TabHost>

Webview xml

<WebView
    android:id="@+id/webView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />


@RanjanSharan请发布一些代码或发布更多信息,以便我们能为您提供更多帮助。嗨,伙计,这是我的代码,请引导我。。