mzgreen / HideOnScrollExample

This is an example on how to show/hide views when scrolling a list.
620 stars 173 forks source link

Tab and Viewpager in fragment ? #7

Open amaydiam opened 9 years ago

amaydiam commented 9 years ago

hai, how it's work, if Tab and Viewpager in fragment ? like this :

``<LinearLayout
            android:layout_width="match_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical"
            android:id="@+id/toolbarContainer">

            <include
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                layout="@layout/toolbar" />

            <FrameLayout
                android:id="@+id/content_frame"
                android:layout_width="wrap_content"
                android:layout_height="match_parent" />
        </LinearLayout>``

and this is layout fragment:

``<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bg_app"
    android:orientation="vertical">

    <com.astuetz.PagerSlidingTabStrip
        android:id="@+id/tabs"
        android:layout_height="@dimen/tabsHeight"
        android:layout_width="fill_parent"
        app:pstsIndicatorColor="@color/primary"
        app:pstsUnderlineColor="@color/grey"
        app:pstsTabSwitch="true"
        app:pstsActivateTextColor="#FF666666"
        app:pstsDeactivateTextColor="#FFAAAAAA"
        app:pstsTabPaddingLeftRight="14dip"
        android:background="@color/background_material_light" />

    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1" />

</LinearLayout>``

this is a child layout viewpager :

``<com.ad.xx.utils.GeneralSwipeRefreshLayout
        android:id="@+id/swipe_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
            <android.support.v7.widget.RecyclerView
                android:id="@+id/grid_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:clipToPadding="false"
                />
    </com.ad.xx.utils.GeneralSwipeRefreshLayout>``