How to make bottom navigation show menu items with icon and text except center item menu show only icon? [closed]

Try below code: XML file: <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical”> <android.support.v7.widget.Toolbar android:id=”@+id/toolbar” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:layout_gravity=”top” android:background=”@color/gray” android:foregroundGravity=”top” android:gravity=”top”> </android.support.v7.widget.Toolbar> <FrameLayout android:layout_width=”match_parent” android:layout_height=”match_parent” android:layout_weight=”1″> <FrameLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/fragment_container” android:layout_width=”match_parent” android:layout_height=”match_parent” /> </FrameLayout> <LinearLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:orientation=”horizontal”> <android.support.design.widget.BottomNavigationView android:id=”@+id/bottomnav” android:layout_width=”0dp” android:layout_height=”56dp” android:layout_weight=”1″ android:background=”null” app:itemIconTint=”@color/green” app:itemTextColor=”@color/green” app:menu=”@menu/main”> </android.support.design.widget.BottomNavigationView> <ImageView android:layout_width=”0dp” android:layout_height=”56dp” android:layout_weight=”0.5″ android:src=”https://stackoverflow.com/questions/44342530/@drawable/camera” /> <android.support.design.widget.BottomNavigationView … Read more

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>

Badge on BottomNavigationView

You can use the BottomNavigationView provided by the Material Components Library. Just add the BottomNavigationView to your layout: <com.google.android.material.bottomnavigation.BottomNavigationView android:layout_gravity=”bottom” app:menu=”@menu/navigation_main” ../> Then use in your code: int menuItemId = bottomNavigationView.getMenu().getItem(0).getItemId(); BadgeDrawable badge = bottomNavigationView.getOrCreateBadge(menuItemId); badge.setNumber(2); To change the badge gravity use the setBadgeGravity method. badge.setBadgeGravity(BadgeDrawable.BOTTOM_END);

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

Set selected item in Android BottomNavigationView

From API 25.3.0 it was introduced the method setSelectedItemId(int id) which lets you mark an item as selected as if it was tapped. From docs: Set the selected menu item ID. This behaves the same as tapping on an item. Code example: BottomNavigationView bottomNavigationView; bottomNavigationView = (BottomNavigationView) findViewById(R.id.bottomNavigationView); bottomNavigationView.setOnNavigationItemSelectedListener(myNavigationItemListener); bottomNavigationView.setSelectedItemId(R.id.my_menu_item_id); IMPORTANT You MUST have already … Read more

How to combine BottomAppBar + FAB with BottomNavigationView

First Way Try this You can Create a CustomBottomNavigationView Here is the good article for CustomBottomNavigationView How I draw custom shapes in BottomNavigationView SAMPLE CODE import android.content.Context; import android.graphics.*; import android.support.design.widget.BottomNavigationView; import android.support.v4.content.ContextCompat; import android.util.AttributeSet; public class CustomBottomNavigationView extends BottomNavigationView { private Path mPath; private Paint mPaint; /** the CURVE_CIRCLE_RADIUS represent the radius of the … Read more

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

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