当前位置:网站首页>CoordinatorLayout+NestedScrollView+RecyclerView 上拉底部显示不全

CoordinatorLayout+NestedScrollView+RecyclerView 上拉底部显示不全

2022-07-06 05:59:00 lichong951

借用一张效果图示意一下:
在这里插入图片描述

显示不全的布局如下:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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" xmlns:tools="http://schemas.android.com/tools" android:background="#FFFFFF">


    <android.support.design.widget.CoordinatorLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#F7F7F7" android:layout_marginTop="71dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" >
....

        <android.support.v4.widget.NestedScrollView android:id="@+id/nestedScrollView" android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true" app:layout_behavior="@string/appbar_scrolling_view_behavior">
            

            <android.support.v7.widget.RecyclerView android:id="@+id/recycle_view" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="20dp" android:background="#FFFFFFFF" android:nestedScrollingEnabled="false" android:paddingLeft="20dp" android:paddingRight="20dp" android:layout_marginBottom="30dp" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:itemCount="40" />
          

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

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

</android.support.constraint.ConstraintLayout>

添加live.bingoogolapple.refreshlayout.BGARefreshLayout组件之后显示正常了

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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" xmlns:tools="http://schemas.android.com/tools" android:background="#FFFFFF">


    <android.support.design.widget.CoordinatorLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#F7F7F7" android:layout_marginTop="71dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" >
....

        <android.support.v4.widget.NestedScrollView android:id="@+id/nestedScrollView" android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true" app:layout_behavior="@string/appbar_scrolling_view_behavior">
            <live.bingoogolapple.refreshlayout.BGARefreshLayout android:id="@+id/mRefreshLayout" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior">

            <android.support.v7.widget.RecyclerView android:id="@+id/recycle_view" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="20dp" android:background="#FFFFFFFF" android:nestedScrollingEnabled="false" android:paddingLeft="20dp" android:paddingRight="20dp" android:layout_marginBottom="30dp" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:itemCount="40" />
            </live.bingoogolapple.refreshlayout.BGARefreshLayout>

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

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

</android.support.constraint.ConstraintLayout>

至于原因暂时没有找到。希望有机会深入原理解析原因!!!!

原网站

版权声明
本文为[lichong951]所创,转载请带上原文链接,感谢
https://blog.csdn.net/lichong951/article/details/125191201