0

У меня есть ящик, который отлично работает на большом устройстве, но занимает весь экран на меньшем устройстве, я пробовал использовать вес, но без успеха, может быть, я внедряю его неправильно? Код ниже. спасибо, спасибо.Укажите размер ящика - Xamarin Android

Без веса

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:id="@+id/drawer_layout" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:fitsSystemWindows="true"> 

<android.support.design.widget.NavigationView 
android:id="@+id/nav_view" 
android:layout_height="match_parent" 
android:layout_width="325dp" 
android:layout_gravity="start" 
android:fitsSystemWindows="true" 
app:menu="@menu/drawer_view" /> 
</android.support.v4.widget.DrawerLayout> 

С весом, но до сих пор не работает

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:id="@+id/drawer_layout" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:weightSum="2" 
android:fitsSystemWindows="true"> 

<android.support.design.widget.NavigationView 
android:id="@+id/nav_view" 
android:layout_height="match_parent" 
android:layout_width="0dp" 
android:layout_weight="1" 
android:layout_gravity="start" 
android:fitsSystemWindows="true" 
app:menu="@menu/drawer_view" /> 
</android.support.v4.widget.DrawerLayout> 

ответ

0

Это полная реализация кода макета NavgiationView.

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:id="@+id/drawer_layout1" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true"> 
<LinearLayout 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    <include 
     android:id="@+id/cin7toolbar" 
     layout="@layout/toolbar" /> 
    <FrameLayout 
     android:id="@+id/flContentSecure" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 
</LinearLayout> 
<android.support.design.widget.NavigationView 
    android:id="@+id/navigation1" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    app:headerLayout="@layout/nav_header" 
    app:menu="@menu/nav_menu_secure" /> 
</android.support.v4.widget.DrawerLayout> 

Надеюсь, что сработает для вас.

Смежные вопросы