I am using android support package v4 and the following layout to show up a scrollable tabbar + corresponding slideable contentviews:
<?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>
It works well lets say 90% but 10% it just don't redraw the ui. Even the invalidate of the elements doesn't solve the problem. Now the strangest part: After locking and relocking the phone, everything shows up like expected and works like a charm.
For example: I add a new tab + fragment. - Tab + Fragment are added, all methods on them are called, but the UI is just black. lock+unlock = everything is okay again.
Handling userinput on fragment. (See pic)
Notice: I already tested the invalidation of all elements, it doesn't work.
What else can I do to solve this problems?
Thanks in advance
There was a memoryleak on the tabhost.