I am writing an app that uses many fragments. I have used ActionBarSherlock (with ActionBar). To work-around bug #240, I've decided to switch a functionally working implementation to use ActionBarSherlock with TabHost. After half a few hours of work, it is working fine, except for when I am swiping between pages: The correspondent tab is selected, but is not centered and often not even visible so the user can't see which tab is selected.
In the picture you can see the visible fragment ("WEEKLY S..") but the tab is only half visible. The next swipe will only make "WEEKLY S..." look like "CALENDAR EVENTS" and I won't know which Tab is selected unless I swipe the TabWidget manually.
Here is my activity_main.xml:
<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">
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbars="none" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tabStripEnabled="true"
android:orientation="horizontal" />
</HorizontalScrollView>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="0"/>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
</TabHost>
And my TabsAdapter is the same as Jake Wharton's example of FragmentTabsPager.
Any suggestions are welcome!