Is there a way to keep fragment alive when using BottomNavigationView with new NavController?

Try this. Navigator Create custom navigator. @Navigator.Name(“custom_fragment”) // Use as custom tag at navigation.xml class CustomNavigator( private val context: Context, private val manager: FragmentManager, private val containerId: Int ) : FragmentNavigator(context, manager, containerId) { override fun navigate(destination: Destination, args: Bundle?, navOptions: NavOptions?) { val tag = destination.id.toString() val transaction = manager.beginTransaction() val currentFragment = manager.primaryNavigationFragment … Read more

Hide/Show bottomNavigationView on Scroll

UPDATE Just add one attribute to BottomNavigationView Material Library AndroidX <com.google.android.material.bottomnavigation.BottomNavigationView …. app:layout_behavior=”com.google.android.material.behavior.HideBottomViewOnScrollBehavior”/> Support Library Version 28.0.0 or higher version <android.support.design.widget.BottomNavigationView …. app:layout_behavior=”@string/hide_bottom_view_on_scroll_behavior”/> Note:- Your XML should follow the structure of XML given below in old answer. **OLD ANSWER(Still Works)** You need a helper class to do this .This solution works like Google Material Design … Read more

Android new Bottom Navigation bar or BottomNavigationView

I think you might looking for this. Here’s a quick snippet to get started: public class MainActivity extends AppCompatActivity { private BottomBar mBottomBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Notice how you don’t use the setContentView method here! Just // pass your layout to bottom bar, it will be taken care of. // … Read more

How to disable BottomNavigationView shift mode?

Implementation of BottomNavigationView has condition: when there is more than 3 items then use shift mode. At this moment you cannot change it through existing API and the only way to disable shift mode is to use reflection. You’ll need helper class: import android.support.design.internal.BottomNavigationItemView; import android.support.design.internal.BottomNavigationMenuView; import android.support.design.widget.BottomNavigationView; import android.util.Log; import java.lang.reflect.Field; public class BottomNavigationViewHelper … Read more