Skip to content

Instantly share code, notes, and snippets.

@knightbenax
Created September 10, 2018 08:22
Show Gist options
  • Save knightbenax/b394760d133ab161c2bdd8966f5aa89b to your computer and use it in GitHub Desktop.
Save knightbenax/b394760d133ab161c2bdd8966f5aa89b to your computer and use it in GitHub Desktop.
Quick fix for padding clipping menu items in BottomAppBar
/**
* Setting the padding on the BottomAppBar instead clips out the menuview for some
* reasons. Feel it's a bug.
*
* So instead would just get the ActionMenuView which houses the menu and apply the
* padding to that instead.
*
* Reuben 1. Google 0.
* **/
for(int i = 0; i < bottomAppBar.getChildCount(); ++i) {
View view = bottomAppBar.getChildAt(i);
if (view instanceof ActionMenuView) {
actionMenuView = (ActionMenuView)view;
break;
}
}
if (actionMenuView != null){
//Adding the padding on both ends for Rtl layouts
actionMenuView.setPadding(20, 0, 20, 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment