huxq17 / XRefreshView

一个万能的android下拉上拉刷新的框架,完美支持recyclerview
1.7k stars 501 forks source link

XRefreshView错位的问题... #109

Closed qhhuang closed 7 years ago

qhhuang commented 7 years ago

我的项目中 使用了CoordinatorLayout , 在 SwipeRefreshLayout/ XRefreshView中添加 app:layout_behavior="@string/appbar_scrolling_view_behavior"属性,让recyclerView加载的数据界面滑动时让顶部视图先滑动缩小高度, 在顶部视图没有收缩时 下拉刷新正常, 顶部视图收缩后 再下拉, 顶部视图高度回到最高后 XRefreshView的header并没有跟着回来, 应该是滑动事件冲突了, 请问下有没有好的解决方案,下面是xml布局 :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"

<android.support.design.widget.CoordinatorLayout android:layout_width="match_parent" android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:id="@+id/middle_app_bar_layut"
        android:layout_height="132dp"
        >
        <android.support.design.widget.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:title=""
            >
            <android.support.v7.widget.Toolbar
                android:id="@+id/tool_bar"
                android:layout_width="match_parent"
                android:layout_height="44dp"
                android:navigationIcon="@drawable/left_icon"
                app:contentInsetLeft="0dp"
                app:contentInsetStart="0dp"
                app:layout_collapseMode="pin"
                app:navigationIcon="@drawable/left_icon">
            </android.support.v7.widget.Toolbar>
        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

    <android.support.v4.widget.SwipeRefreshLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/middle_swipe_refresh_layout"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        >
        <android.support.v7.widget.RecyclerView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/middle_recycle_view">
        </android.support.v7.widget.RecyclerView>

    </android.support.v4.widget.SwipeRefreshLayout>

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

<TextView
    android:layout_width="wrap_content"
    android:layout_height="44dp"
    android:textColor="@color/white"
    android:text="我是标题"
    android:id="@+id/middle_title"
    android:gravity="center"
    android:layout_centerHorizontal="true"

    android:textAlignment="center"/>

<com.xxxx.BaseSearchView
    android:layout_width="match_parent"
    android:layout_height="44dp"
    android:id="@+id/middle_search_view"
    android:background="@color/bdIncell"
    android:layout_marginTop="44dp"
    />
<com.xxxx.View.TSearchTopView
    android:layout_width="match_parent"
    android:layout_height="44dp"
    android:id="@+id/tender_search_top_view"
    android:background="@color/white"
    android:layout_marginTop="88dp"></com.xxxx.View.TSearchTopView>

icqapp commented 7 years ago

同问!!!!!!! <?xml version="1.0" encoding="utf-8"?> <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>

qhhuang commented 7 years ago

我现在使用了这个 https://github.com/scwang90/SmartRefreshLayout 解决了这个问题...

icqapp commented 7 years ago

我的已经解决了!还是用他XRecycleView这个框架,我已经提issues了,请看https://github.com/huxq17/XRefreshView/issues/112