mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Sets the proper width to Navigation drawer in portrait and landscape mode.
Fixes #1275
This commit is contained in:
parent
3bd02704b5
commit
4861c4dfa3
3 changed files with 13 additions and 2 deletions
|
|
@ -88,8 +88,11 @@ public abstract class NavigationBaseActivity extends BaseActivity
|
||||||
|
|
||||||
private void setDrawerPaneWidth() {
|
private void setDrawerPaneWidth() {
|
||||||
ViewGroup.LayoutParams params = navigationView.getLayoutParams();
|
ViewGroup.LayoutParams params = navigationView.getLayoutParams();
|
||||||
// set width to lowerBound of 80% of the screen size
|
// set width to lowerBound of 70% of the screen size in portrait mode
|
||||||
params.width = (getResources().getDisplayMetrics().widthPixels * 70) / 100;
|
// 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);
|
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