mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Merge pull request #1279 from knight-shade/Fixes-#1275
Fixes #1275 Set proper with of Navigation drawer in both orientations.
This commit is contained in:
commit
ce8c807348
3 changed files with 13 additions and 2 deletions
|
|
@ -88,8 +88,11 @@ public abstract class NavigationBaseActivity extends BaseActivity
|
|||
|
||||
private void setDrawerPaneWidth() {
|
||||
ViewGroup.LayoutParams params = navigationView.getLayoutParams();
|
||||
// set width to lowerBound of 80% of the screen size
|
||||
params.width = (getResources().getDisplayMetrics().widthPixels * 70) / 100;
|
||||
// set width to lowerBound of 70% of the screen size in portrait mode
|
||||
// set width to lowerBound of 50% of the screen size in landscape mode
|
||||
int percentageWidth = getResources().getInteger(R.integer.drawer_width);
|
||||
|
||||
params.width = (getResources().getDisplayMetrics().widthPixels * percentageWidth) / 100;
|
||||
navigationView.setLayoutParams(params);
|
||||
}
|
||||
|
||||
|
|
|
|||
4
app/src/main/res/values-land/integer.xml
Normal file
4
app/src/main/res/values-land/integer.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<integer name="drawer_width">50</integer>
|
||||
</resources>
|
||||
4
app/src/main/res/values/integer.xml
Normal file
4
app/src/main/res/values/integer.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<integer name="drawer_width">70</integer>
|
||||
</resources>
|
||||
Loading…
Add table
Add a link
Reference in a new issue