Created
February 23, 2017 12:34
-
-
Save waqasakram117/93773cea696ee1e11cbc591004872ba6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // A method to find height of the status bar this will useful with navigation drawer | |
| public int getStatusBarHeight() { | |
| int result = 0; | |
| int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); | |
| if (resourceId > 0) { | |
| result = getResources().getDimensionPixelSize(resourceId); | |
| } | |
| return result; | |
| } | |
| // Retrieve the AppCompact Toolbar | |
| Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | |
| setSupportActionBar(toolbar); | |
| // Set the padding to match the Status Bar height | |
| toolbar.setPadding(0, getStatusBarHeight(), 0, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment