bottomnavigationview

Fragment re-created on bottom navigation view item selected

跟風遠走 提交于 2019-12-18 10:33:14
问题 Following is my code for bottom navigation view item selected bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { Fragment fragment = null; switch (item.getItemId()) { case R.id.action_one: // Switch to page one fragment = FragmentA.newInstance(); break; case R.id.action_two: // Switch to page two fragment = FragmentB.newInstance(); break; case R.id

Background color change in BottomNavigationView

旧城冷巷雨未停 提交于 2019-12-17 22:23:40
问题 I have implemented BottomNavigationView which is available from the new support library 25.0.0. Here is my code for that <android.support.design.widget.BottomNavigationView android:id="@+id/bottom_navigation" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" app:itemBackground="@color/colorPrimary" app:itemIconTint="@drawable/text" app:itemTextColor="@drawable/text" app:menu="@menu/bottom_navigation_main" /> And text.xml drawable

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

倾然丶 夕夏残阳落幕 提交于 2019-12-17 10:33:18
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I want to create bottom navigation bar show menu items icon and text except center item. eg. i have attached image 回答1: 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:/

Getting back the old BottomBar

泪湿孤枕 提交于 2019-12-14 03:03:31
问题 Just started a new app and when including a BottomNavigationView the result look like that : I really don't get where it come from and how can I get back to the old version that are still defined in the spec Does someone know where these changes come from ? 回答1: by default BottomNavigationView add shiftingmode = true when its more than 3 items. so try this static void removeShiftMode(BottomNavigationView view) { BottomNavigationMenuView menuView = (BottomNavigationMenuView) view.getChildAt(0)

Is BottomNavigationView supported in SDK 22?

て烟熏妆下的殇ゞ 提交于 2019-12-13 22:12:33
问题 It is a simple question. Can I use BottomNavigationView in sdk 22? I tested with emulator with sdk 22, and it seems to work well. But, BottomNavigatoinView is released in SDK 25. Does the provide backward compatibility? 回答1: BottomNavigatoinView is released in SDK 25 I am uncertain where you determined this. BottomNavigationView is part of the Design Support library, which is being migrated to the Material Components for Android (for when you migrate to AndroidX). Both implementations work

BottomNavigationBar-change the tab icon color

家住魔仙堡 提交于 2019-12-13 11:35:30
问题 I've integrated Bottom Bar Navigation bar on my app. But when I swipe, tab's color doesn't change. It's weird cause I have selector file. Any idea to solve this problem? Activity.java BottomNavigationView bottomNavigationView = (BottomNavigationView) findViewById(R.id.bottom_navigation); bottomNavigationView.setOnNavigationItemSelectedListener( new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { switch (item

Android - Change color of icon and title of each tab bottom navigation

亡梦爱人 提交于 2019-12-13 01:18:51
问题 I'm trying to make a bottom navigation a bit tricky. Indeed I want this kind of bottom navigation : Each tab has a different color when it is selected. For example measure will be in red when selected (icon and title) and profile will be green when selected... So I tried to use a selector per item (in my menu) But the color is not applied. The icon change successfully (I tried to put a completely different icon when an item is selected) but not the color of the title of the tab. I tried to

How to change text padding in android bottom navigation view

时光总嘲笑我的痴心妄想 提交于 2019-12-12 10:31:37
问题 I am using the bottom navigation view for an android app. I have increased the size of my icon, but now the icon runs over the text. Here is what I see: Here is a diagram of the bottom navigation view according to google design docs: The number 10, I want to change that padding, but when I look in the properties for the navigation bar, I don't see where I can do it. How can I change it to a smaller number? In my bottom_layout.xml I am setting my items up like so: <item android:id="@+id/menu

How do I add elevation (shadow) to my BottomNavigationView. It doesn't come by default

寵の児 提交于 2019-12-12 09:34:01
问题 I tried setting elevation from xml and programmatically both. But nothing works. 回答1: It only works if you set white as android:background in the BottomNavigationView. This is my code and it's working: <android.support.design.widget.BottomNavigationView android:id="@+id/bottom_navigation" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_gravity="bottom" android:background="@color/white" app:elevation="8dp" app:itemIconTint="@color/bottom_color_state" app

BottomNavigationView overlapping FrameLayout in CoordinatorLayout

ε祈祈猫儿з 提交于 2019-12-12 08:25:48
问题 The following is my layout xml. The problem now is that the BottomNavigationView is overlapping the FrameLayout. I wanted the FrameLayout to stretch to the top of the BottomNavigationView. I tried with trick such as adding paddingBottom in the FrameLayout but I wonder if there is other better solution. Thanks. <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com