I have an existing app that makes use of ViewPager
and PagerTabStrip
and this has been working for a long time with various releases of the Android SDK and the com.android.support:appcompat-v7
library. I've just bumped up the compile and target SDK versions of my app from 23
to 24
and the com.android.support:appcompat-v7
library version from 23.4.0
to 24.0.0
... and I now see that the PagerTabStrip
is totally missing from the ViewPager
. (Not just missing titles in the PagerTabStrip
... the PagerTabStrip
is totally missing from the ViewPager
when the views are rendered.)
This is how I'm declaring the ViewPager
and PagerTabStrip
views in my layout file:
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<android.support.v4.view.PagerTabStrip
android:id="@+id/pagerTabStrip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:textColor="@android:color/white"
android:background="@color/view_bg_blue" />
</android.support.v4.view.ViewPager>
Can anyone spot something that I'm doing wrong or could this be a bug in ViewPager
and PagerTabStrip
?
This is the temporary workaround until the issue is resolved in the Android support library:
((ViewPager.LayoutParams) pagerTabStrip.getLayoutParams()).isDecor = true;
See here for a fuller discussion on the status of the issue: https://code.google.com/p/android/issues/detail?id=213359
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With