How to use BottomNavigationBar with Navigator?

int index = 0; @override Widget build(BuildContext context) { return new Scaffold( body: new Stack( children: <Widget>[ new Offstage( offstage: index != 0, child: new TickerMode( enabled: index == 0, child: new MaterialApp(home: new YourLeftPage()), ), ), new Offstage( offstage: index != 1, child: new TickerMode( enabled: index == 1, child: new MaterialApp(home: new YourRightPage()), … 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

Fragment re-created on bottom navigation view item selected

With support library v26 you can do this FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction(); Fragment curFrag = mFragmentManager.getPrimaryNavigationFragment(); if (curFrag != null) { fragmentTransaction.detach(curFrag); } Fragment fragment = mFragmentManager.findFragmentByTag(tag); if (fragment == null) { fragment = new YourFragment(); fragmentTransaction.add(container.getId(), fragment, tag); } else { fragmentTransaction.attach(fragment); } fragmentTransaction.setPrimaryNavigationFragment(fragment); fragmentTransaction.setReorderingAllowed(true); fragmentTransaction.commitNowAllowingStateLoss();

Android Jetpack Navigation, BottomNavigationView with Youtube or Instagram like proper back navigation (fragment back stack)?

You don’t really need a ViewPager to work with BottomNavigation and the new Navigation architecture component. I have been working in a sample app that uses exactly the two, see here. The basic concept is this, you have the main activity that will host the BottomNavigationView and that is the Navigation host for your navigation … Read more

item selected color in android BottomNavigationView

create a color directory in res folder and create your xml file for customize your bottom navigation items: res/color/bottom_nav_color.xml: <?xml version=”1.0″ encoding=”utf-8″?> <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:state_checked=”true” android:color=”@color/your_color” /> <item android:state_checked=”false” android:color=”@color/your_color”/> </selector> and in your BottomNavigationView set app:itemTextColor and app:itemIconTint values to @color/bottom_nav_color <android.support.design.widget.BottomNavigationView xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” android:id=”@+id/main_navigation” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:layout_alignParentBottom=”true” android:background=”@color/actionBarColor” app:menu=”@menu/my_navigation_items” app:itemTextColor=”@color/bottom_nav_color” app:itemIconTint=”@color/bottom_nav_color”/>

Android: Bottom Navigation View – change icon of selected item

You can simply create drawable selector in drawable folder and image can be change according to the state of the widget used in view <?xml version=”1.0″ encoding=”utf-8″?> <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:drawable=”@drawable/calender_green” android:state_checked=”true”/> <item android:drawable=”@drawable/calender_black” android:state_checked=”false”/> </selector>

Display badge on top of bottom navigation bar’s icon

If you just want to use a stock BottomNavigationView and no third party lib here’s how I’ve done it: BottomNavigationMenuView bottomNavigationMenuView = (BottomNavigationMenuView) navigationView.getChildAt(0); View v = bottomNavigationMenuView.getChildAt(3); BottomNavigationItemView itemView = (BottomNavigationItemView) v; View badge = LayoutInflater.from(this) .inflate(R.layout.notification_badge, itemView, true); Then here’s the layout file: <merge 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”> <TextView android:id=”@+id/notifications.badge” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_gravity=”top|center_horizontal” android:layout_marginLeft=”10dp” … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)