我正在使用android支持包v4和以下布局来显示可滚动的tabbar +相应的可滑动内容视图:
<?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">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:gravity="center_vertical"
android:layout_height="wrap_content">
<HorizontalScrollView
android:layout_width="wrap_content"
android:id="@+id/horizontalScrollView"
android:orientation="horizontal"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbars="none">
<TabWidget
android:id="@android:id/tabs"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</HorizontalScrollView>
</LinearLayout>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0"/>
<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
</TabHost>
它运作良好可以说90%但是10%它只是不重绘ui。即使元素无效也无法解决问题。 现在最奇怪的部分:锁定和重新锁定手机后,一切都像预期的那样出现,就像一个魅力。
例如: 我添加了一个新标签+片段。 - 添加Tab + Fragment,调用它们上的所有方法,但UI只是黑色。锁定+解锁=一切都好了。
处理片段上的userinput。 (见图)
注意: 我已经测试了所有元素的失效,但它不起作用。
我还能做些什么来解决这个问题?
提前致谢
答案 0 :(得分:0)
tabhost上有一个记忆漏洞。