liaohuqiu / android-Ultra-Pull-To-Refresh

Ultra Pull to Refresh for Android. Support all the views.
MIT License
9.58k stars 2.65k forks source link

Use the Google Support Design 22.2.0 CoordinatorLayout and TabLayout event conflict. #115

Open ohshi000 opened 9 years ago

ohshi000 commented 9 years ago

The toolbar will dismiss with aim. But event has some conflict. when RecyclerView scroll Y is 0. Scroll down the recycler view. will a little bit block. app:layout_behavior="@string/appbar_scrolling_view_behavior" this is important Here is the layout. ViewPager has a "PTR Layout and include a RecyclerView" <android.support.design.widget.CoordinatorLayout android:id="@+id/main_content" 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.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:layout_scrollFlags="scroll|enterAlways"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>

    <android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        style="@style/TabLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

</android.support.design.widget.AppBarLayout>

<android.support.v4.view.ViewPager
    android:id="@+id/viewpager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<com.gridy.main.view.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/icon_write"
    android:layout_margin="8dp"
    android:layout_gravity="end|bottom"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    app:fab_showAnimation="@anim/show_from_bottom"
    app:fab_hideAnimation="@anim/hide_to_bottom"
    app:fab_colorNormal="@color/color_actionbar"
    app:fab_colorPressed="@color/color_sky_blue"
    app:layout_anchorGravity="bottom|right|end" />

</android.support.design.widget.CoordinatorLayout>

thinwonton commented 9 years ago

the same problem i met.

ohshi000 commented 9 years ago

I just used another library "SuperRecylcerView"

monakhv commented 8 years ago

I had the same problem. However that can be fixed by 1 Setting AppBarLayout.OnOffsetChangedListener to trace offset 2 Modify PtrHandler.checkCanDoRefresh

put there something like

@Override public boolean checkCanDoRefresh(PtrFrameLayout frame, View content, View header) {

    return  (mAppBarOffset==0) &&PtrDefaultHandler.checkContentCanBePulledDown(frame, content, header);
}
wilsonssss commented 7 years ago

@johnzheng00 Hi man, you should try this way: #207