[英]How can I make seperate navigation for each bottom nav view without recreation fragment?
I need to make navigation like Instagram navigation.我需要像 Instagram 导航一样进行导航。 First five fragment should not be created after that called once.
在调用一次之后不应创建前五个片段。
There are three way有三种方式
make five different fragment container and push fragment in it's container.制作五个不同的片段容器并将片段推送到它的容器中。 for example:
例如:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:orientation="horizontal"> <FrameLayout android:id="@+id/fragment_container_post" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" /> <FrameLayout android:id="@+id/fragment_container_message" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:visibility="gone" /> <FrameLayout android:id="@+id/fragment_container_add_post" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:visibility="gone" /> <FrameLayout android:id="@+id/fragment_like" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:visibility="gone" /> <FrameLayout android:id="@+id/fragment_profile" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:visibility="gone" /> </LinearLayout> <android.support.design.widget.BottomNavigationView android:id="@+id/bottom_navigation" android:layout_width="match_parent" android:layout_height="wrap_content" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_gravity="bottom" app:itemIconTint="@drawable/selector_bottombar_item" app:itemTextColor="@drawable/selector_bottombar_item" android:background="@color/white" app:onNavigationItemSelected="@{viewModel.onNavigationClick}" app:menu="@menu/bottombar_menu" xmlns:android="http://schemas.android.com/apk/res/android" /> </LinearLayout>
Make viewpager with not swipable and set OffsetLimit
5使 viewpager 不可滑动并设置
OffsetLimit
5
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.