Max navigation drawer width
This commit is contained in:
@@ -101,12 +101,13 @@ public class EmailListActivity extends ActionBarActivity implements
|
||||
|
||||
// Set the drawer width per Material design spec
|
||||
// http://www.google.com/design/spec/layout/structure.html#structure-side-nav-1
|
||||
// Mobile: side nav width = screen width - app bar height
|
||||
// Desktop: Max width for left nav is 400 dp. Not handled yet.
|
||||
// Mobile: side nav width = min(screen width - app bar height, 320dp)
|
||||
// Desktop: side nav width = min(screen width - app bar height, 400dp)
|
||||
int maxWidth = getResources().getDimensionPixelSize(R.dimen.nav_max_width);
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
DrawerLayout.LayoutParams lp = (DrawerLayout.LayoutParams) mDrawerOuter.getLayoutParams();
|
||||
lp.width = dm.widthPixels - toolbar.getLayoutParams().height;
|
||||
lp.width = Math.min(dm.widthPixels - toolbar.getLayoutParams().height, maxWidth);
|
||||
|
||||
// Set the list of folders
|
||||
// TODO: This is slow, needs a loader
|
||||
|
||||
@@ -5,4 +5,6 @@
|
||||
screen margins) for sw600dp devices (e.g. 7" tablets) here.
|
||||
-->
|
||||
|
||||
<dimen name="nav_max_width">400dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
|
||||
<dimen name="nav_max_width">320dp</dimen>
|
||||
<dimen name="nav_horizontal_margin">16dp</dimen>
|
||||
<dimen name="nav_entry_height">48dp</dimen>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user