Created
September 10, 2018 08:22
-
-
Save knightbenax/b394760d133ab161c2bdd8966f5aa89b to your computer and use it in GitHub Desktop.
Quick fix for padding clipping menu items in BottomAppBar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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