Android(滚动并不是一直到底)

得意犹堪夸世俗,诏黄新湿字如鸦。这篇文章主要讲述Android:滚动并不是一直到底相关的知识,希望能为你提供帮助。
我一直在努力让我的工具栏在滚动时隐藏。我已经设法将它整理好了,现在我遇到了一个不同的问题,当我在我的Recyclerview中滚动最后一张卡时,它被削减了一半。我无法完全看到最后一张卡/卡。
见图:

Android(滚动并不是一直到底)

文章图片

主要活动布局:
< ?xml version="1.0" encoding="utf-8"?> < android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.example.admin.paws.MainActivity"> < android.support.design.widget.AppBarLayout android:layout_height="wrap_content" android:layout_width="match_parent"> < 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"/> < /android.support.design.widget.AppBarLayout> < !--scrolling view should remain here so the above inherits behavior--> < FrameLayout android:id="@+id/fram" android:layout_width="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:layout_height="wrap_content"> < /FrameLayout> < android.support.design.widget.BottomNavigationView android:id="@+id/navigation" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" android:background="?android:attr/windowBackground" app:menu="@menu/navigation" /> < /android.support.design.widget.CoordinatorLayout>

片段布局:
< ?xml version="1.0" encoding="utf-8"?> < android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/coordinatorLayout" android:layout_width="match_parent" android:layout_height="wrap_content"> < android.support.v7.widget.RecyclerView android:id="@+id/recycler_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:scrollbars="vertical" /> < /android.support.design.widget.CoordinatorLayout>

答案试试这个..
app:layout_scrollFlags="scroll|enterAlways|snap"

要么
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { if (dy > 0 & & bottom_navigation.isShown()) { bottom_navigation.setVisibility(View.GONE); } else if (dy < 0 ) { bottom_navigation.setVisibility(View.VISIBLE); } }@Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) {super.onScrollStateChanged(recyclerView, newState); } });

更好地在实际设备中检查它。
另一答案【Android(滚动并不是一直到底)】试试这个,你需要把你的BottomNavigationViewFrameLayout包裹在RelativeLayout里面
< android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.example.admin.paws.MainActivity"> < android.support.design.widget.AppBarLayout android:layout_height="wrap_content" android:layout_width="match_parent"> < 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"/> < /android.support.design.widget.AppBarLayout> < RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> < !--scrolling view should remain here so the above inherits behavior--> < FrameLayout android:id="@+id/fram" android:layout_width="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:layout_height="wrap_content" android:layout_above="@+id/navigation" /> < android.support.design.widget.BottomNavigationView android:id="@+id/navigation" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" android:background="?android:attr/windowBackground" android:align_parent_bottom = "true" app:menu="@menu/navigation" /> < /RelativeLayout> < /android.support.design.widget.CoordinatorLayout>


    推荐阅读