Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XRefreshView与AppBarLayout滑动冲突, #112

Open
icqapp opened this issue Aug 17, 2017 · 1 comment
Open

XRefreshView与AppBarLayout滑动冲突, #112

icqapp opened this issue Aug 17, 2017 · 1 comment

Comments

@icqapp
Copy link

icqapp commented Aug 17, 2017

当XRefreshView上拉使得AppBarLayout隐藏后,我设置AppBarLayout.addOnOffsetChangedListener(this);事件监听来设置XRefreshView的setPullRefreshEnable方法,但是不管用!!!XR还是不能下拉使得AppBarLayout显示出来
@OverRide
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
Log.d("AppBarLayout:","位移:"+verticalOffset);
xRefreshView.setPullRefreshEnable(verticalOffset == 0);//不能下拉
}
xml代码如下

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:icqapp="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="100dp"
    android:fitsSystemWindows="true"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        icqapp:contentScrim="?attr/colorPrimary"
        icqapp:expandedTitleMarginEnd="64dp"
        icqapp:expandedTitleMarginStart="48dp"
        icqapp:layout_scrollFlags="scroll|exitUntilCollapsed">

        <ImageView
            android:id="@+id/backdrop"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            android:scaleType="centerCrop"
            android:src="@drawable/ic_toolbar_head"
            icqapp:layout_collapseMode="parallax" />


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

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


<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    icqapp:layout_behavior="@string/appbar_scrolling_view_behavior">

    <com.andview.refreshview.XRefreshView
        android:id="@+id/xrefreshview"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/rv_datas"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scrollbars="vertical" />
    </com.andview.refreshview.XRefreshView>

</LinearLayout>

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

@icqapp
Copy link
Author

icqapp commented Aug 17, 2017

已经解决!!!
可以这样改
@OverRide
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
Log.d("AppBarLayout:","位移:"+verticalOffset);
//xRefreshView.setPullRefreshEnable(verticalOffset == 0);//不能下拉
xRefreshView.setEnabled(verticalOffset == 0);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant