的WebView里面没有TabHost显示在蜂窝时打开的选项卡第一次 [英] WebView not shown inside TabHost on Honeycomb when open tab first time
问题描述
有以下几种观点在我的应用程序:
Have the following view in my app:
<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>
在活动:
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");
当我第一次公开说明标签 - - 网页视图未显示
一切罚款的Android 1.6-2.3但在蜂窝(在Android 3.1模拟器测试)。返回previous选项卡,打开之后 - 正常显示网页视图
Everything fine for Android 1.6-2.3 But on Honeycomb (tested on Android 3.1 emulator) - when I first time open description tab - webview not shown. After return to previous tab and open again - webview shown properly.
推荐答案
虽然我仍然认为这是错误的蜂窝(但在这里找到类似的 HTTP://$c$c.google.com/p/android/issues/detail ID = 15399 2.2)我找到了解决方法:
While I still thinking that this is Honeycomb bug (but found something similar here http://code.google.com/p/android/issues/detail?id=15399 for 2.2), I found the workaround:
使用的android:layout_height =WRAP_CONTENT的网页流量,而不是FILL_PARENT仍然给我什么,我想,立刻显示
Use android:layout_height="wrap_content" for webview instead of fill_parent still give me what I want and shown immediately.
这篇关于的WebView里面没有TabHost显示在蜂窝时打开的选项卡第一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!