Good day.
I want the leaving curtain to be wider than in the standard call. (Not full screen, but the remaining space, I would like to be reduced 2 times) How can this be done?
This is the current markup.

<include layout="@layout/app_bar_main" android:layout_width="match_parent" android:layout_height="match_parent" /> <android.support.design.widget.NavigationView android:id="@+id/nav_view" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="start" app:headerLayout="@layout/menus" style="@style/AppTheme" android:background="@drawable/mfon" /> </android.support.v4.widget.DrawerLayout> 
  • one
    When I tried to make this window wider, except for obviously setting the size, I could not otherwise. Maximum 400dp seems. - McDaggen

2 answers 2

For the width, the android: layout_width attribute is responsible. Set it to the desired value. For example, to make a curtain width across the contents

 android:layout_width="wrap_content" 

in your markup it will be like this

  <include layout="@layout/app_bar_main" android:layout_width="match_parent" android:layout_height="match_parent" /> <android.support.design.widget.NavigationView android:id="@+id/nav_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" app:headerLayout="@layout/menus" style="@style/AppTheme" android:background="@drawable/mfon" /> </android.support.v4.widget.DrawerLayout> 
  • No, this option does not work, layout_width = "match_parent" and android: layout_width = "wrap_content" work in the same way. It only works if manually set, for example android: layout_width = "500dp" You can of course initialize in the code, but I would like to implement it with a layout tool. - tosh17
  • then you can try android: layout_marginRight using even negative values - tilin
  • Tried to play with the parameters only responds to positive values. - tosh17
  • Set for example android: layout_marginRight = "- 64dp" for android.support.v4.widget.DrawerLayout - tilin
  • If you change the indent for DrawerLayout, then the entire main window crawls to the right, and the curtain as opened for about 75% of the screen and opens - tosh17

Unfortunately, I could not find it through the layout. I decided to stop at the software version.
Maybe someone will come in handy. The shutter fills 95% of the screen

  nv=findViewById(R.id.nav_view); Display display = getWindowManager().getDefaultDisplay(); int w=displaymetrics.widthPixels; DrawerLayout.LayoutParams lp = (DrawerLayout.LayoutParams) nv.getLayoutParams(); lp.width= (int) (w*0.95);