astuetz / PagerSlidingTabStrip

An interactive indicator to navigate between the different pages of a ViewPager
139 stars 44 forks source link

PSTS demo app not working with ViewPager nested inside another Layout #258

Open hoonkai opened 8 years ago

hoonkai commented 8 years ago

Hi

I'm playing with PSTS's sample app and trying to wrap the ViewPager inside another layout like so:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <com.astuetz.PagerSlidingTabStrip
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="48dip"
        android:background="@drawable/background_tabs" />

<FrameLayout android:layout_width="match_parent" android:layout_height="match_parent">
    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/colors"
        android:layout_below="@+id/tabs"
        tools:context=".MainActivity" />
</FrameLayout>
...

However, neither swiping nor updating the ViewPager works. If the ViewPager wasn't wrapped, then it all works fine. So could the ViewPager be nested inside another layout?

Nothing works if both the PSTS and ViewPager were wrapped inside the same nested layout either.

Thanks