Android:SwipeRefreshLayout和ViewPager滑动冲突的原因和正确的解决方式

android:layout_width=“match_parent”

android:layout_height=“wrap_content”

android:orientation=“vertical”

app:layout_scrollFlags=“scroll|enterAlways|snap”>

<LinearLayout

android:layout_width=“match_parent”

android:layout_height=“match_parent”

android:orientation=“vertical”

app:layout_behavior=“@string/appbar_scrolling_view_behavior”>

<com.jiutong.base.utils.tablayout.TabLayout

android:id=“@+id/mTabLayout”

style=“@style/CustomerTabLayout”

android:layout_width=“match_parent”

android:layout_height=“50dp”

app:tabGravity=“fill”

app:tabMode=“fixed” />

<com.jiutong.base.utils.VerticalScrollView

android:layout_width=“match_parent”

android:layout_height=“match_parent”

android:fillViewport=“true”

app:layout_behavior=“@string/appbar_scrolling_view_behavior”>

<android.support.v4.view.ViewPager

android:id=“@+id/mViewPager”

android:layout_width=“match_parent”

android:layout_height=“wrap_content” />

</com.jiutong.base.utils.VerticalScrollView>

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

</com.jiutong.base.utils.VpSwipeRefreshLayout>


 //动态刷新主界面的下来刷新

        mRecyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {

            override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) {

                val topRowVerticalPosition = if (recyclerView == null || recyclerView!!.getChildCount() === 0) 0 else recyclerView!!.getChildAt(0).getTop()

                if (typeActivity == BaseFieldsConstant.IN_STORAGE_ACTIVITY) {

                    PartsInStorageActivity.mInStorageSwipeRefreshLayout?.isEnabled = topRowVerticalPosition >= 0

                } else {

                    PartsOutStorageActivity.mOutStorageStaicSwipeRefreshLayout?.isEnabled = topRowVerticalPosition >= 0

                }

            }

        })

文末

我总结了一些Android核心知识点,以及一些最新的大厂面试题、知识脑图和视频资料解析。

以后的路也希望我们能一起走下去。(谢谢大家一直以来的支持)

部分资料一览:

  • 330页PDF Android学习核心笔记(内含8大板块)

  • Android学习的系统对应视频

  • Android进阶的系统对应学习资料

  • Android BAT大厂面试题(有解析)


对应学习资料**

[外链图片转存中…(img-jID2MTpu-1719803471723)]

  • Android BAT大厂面试题(有解析)

[外链图片转存中…(img-7Pq4ZORG-1719803471723)]

  • 25
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值