Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/179.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 第一次打开选项卡时,蜂巢上的TabHost内未显示WebView_Android_Webview_Android 3.0 Honeycomb_Android Tabhost - Fatal编程技术网

Android 第一次打开选项卡时,蜂巢上的TabHost内未显示WebView

Android 第一次打开选项卡时,蜂巢上的TabHost内未显示WebView,android,webview,android-3.0-honeycomb,android-tabhost,Android,Webview,Android 3.0 Honeycomb,Android Tabhost,在我的应用程序中具有以下视图: <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" and

在我的应用程序中具有以下视图:

<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"
    android:paddingTop="0dip">
    <TabWidget android:id="@android:id/tabs"
        android:layout_width="fill_parent" android:layout_height="wrap_content" />
    <FrameLayout android:id="@android:id/tabcontent"
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:padding="5dp">
        <ScrollView android:layout_width="fill_parent"
            android:layout_height="fill_parent">
            ....first tab content....
        </ScrollView>
        <WebView android:id="@+id/description" android:layout_width="fill_parent"
            android:layout_height="fill_parent" android:layout_weight="1">
        </WebView>
    </FrameLayout>
</LinearLayout>
</TabHost>

安卓1.6-2.3的一切都很好,但在蜂巢上(在安卓3.1模拟器上测试)-当我第一次打开“描述”选项卡时-未显示webview。返回到上一个选项卡并再次打开-webview显示正确。

虽然我仍然认为这是蜂窝状缺陷(但在2.2中发现了类似的问题),但我找到了解决方法:

使用android:layout\u height=“wrap\u content”代替fill\u家长仍然会给我想要的并立即显示

TabHost tabHost = getTabHost();
tabHost.addTab(tabHost.newTabSpec("tab_details").setIndicator("Details",getResources().getDrawable(R.drawable.ic_tab_details)).setContent(R.id.details));
tabHost.addTab(tabHost.newTabSpec("tab_description").setIndicator("Description",getResources().getDrawable(R.drawable.ic_tab_description)).setContent(R.id.description));
tabHost.setCurrentTab(0);

WebView descriptionView = (WebView)findViewById(R.id.description);

String formattedDescription = converter.toHtmlPage(description);
descriptionView.loadData(formattedDescription, "text/html", "utf-8");