【发布时间】:2021-10-10 14:42:31
【问题描述】:
您好,我想在 recylerview 向上滚动时隐藏底部导航,但在 recylerview 向下滚动并且当 recylerview 停止时我希望底部导航出现 也喜欢幻灯片动画,就像底部工作表一样
我有一个主要活动,其中我给出了底部导航和一个片段容器作为包含片段容器包含我的所有片段
这是我的代码
请注意,如果有人想要更多代码参考,请告诉我我会 更新问题
好的,我在 bootom nav xml 中使用了app:layout_behavior="@string/hide_bottom_view_on_scroll_behavior",但它不起作用
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
tools:context=".MainActivity">
<include
android:id="@+id/fragment_container"
layout="@layout/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<include
android:id="@+id/bottom_navigation_view"
layout="@layout/bottom_navigation_view" />
</RelativeLayout>
bottom_nav_view.xml
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.bottomnavigation.BottomNavigationView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/bottom_navigation_view_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:layout_marginBottom="10dp"
android:background="@drawable/bottom_navigation_style"
android:elevation="5dp"
app:itemIconSize="30dp"
app:itemIconTint="@color/white"
app:itemRippleColor="@android:color/transparent"
app:labelVisibilityMode="unlabeled"
app:layout_behavior="@string/hide_bottom_view_on_scroll_behavior"
app:menu="@menu/bottom_navigation">
</com.google.android.material.bottomnavigation.BottomNavigationView>
【问题讨论】:
标签: android android-recyclerview bottomnavigationview