SmoothBottomBar icon indicating copy to clipboard operation
SmoothBottomBar copied to clipboard

setSelectedItem?

Open afsc19 opened this issue 3 years ago • 5 comments

Hello, I'm developing an app which contains Smooth Bottom Bar. I'd like to keep the selected item when the app re-opens. For that I save the selected item in shared preferences and re-use it on re-open. I replace the fragment I want, but the bottom bar doesn't have any function to select the item or to 'fakeclick' programmatically. Thanks in advance, -afsc.

afsc19 avatar Apr 01 '21 11:04 afsc19

Have you tried setActiveIndex?

brookmg avatar Apr 07 '21 05:04 brookmg

bottomBar.itemActiveIndex = position worked for me, thanks.

paktech1 avatar May 01 '21 10:05 paktech1

bottomBar.itemActiveIndex = position doesn't change the fragment .

milon27 avatar Jun 19 '21 14:06 milon27

Implement that features on this pull : pull request added select iem

@afsc19 @paktech1 @brookmg

milon27 avatar Jun 19 '21 17:06 milon27

Menu menuBottom ;


bottomNavigationView.setItemActiveIndex(3);
NavigationUI.onNavDestinationSelected(menuBottom.getItem(3), navController);    


private void setupSmoothBottomBar() {
        PopupMenu popupMenu = new PopupMenu(this, null);
        popupMenu.inflate(R.menu.menu_bottom);
        menuBottom = popupMenu.getMenu();
        bottomNavigationView.setupWithNavController(menuBottom, navController);
    }

m1faridi avatar Jan 21 '22 11:01 m1faridi