3

Я следовать google drawer specандроид вид навигации - обрезается ящик

И я использую стиль по умолчанию класса «NavigationView» в android-support-design library, ящик будет «полный рост» стиль:
enter image description here

Но на самом деле мне нужен «обрезанный» ящик:
enter image description here

Как сделать обрезанный ящик? Любое предложение?

Большое спасибо!

редактировать: .xml файл

<?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:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true" > 

<!-- include your content layout --> 

<android.support.design.widget.CoordinatorLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/main_content" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical" > 

     <include layout="@layout/toolbar" /> 

     <FrameLayout 
      android:id="@+id/fragment_container" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_weight="1" > 

      <fragment 
       android:id="@+id/homepage" 
       android:name="com.technotalkative.navigationviewdemo.MyFragment" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" /> 
     </FrameLayout> 
    </LinearLayout> 
</android.support.design.widget.CoordinatorLayout> 

<!-- Navigation view --> 

<android.support.design.widget.NavigationView 
    android:id="@+id/navigation_view" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    app:headerLayout="@layout/drawer_header" 
    android:layout_marginTop="@dimen/topMargin" 
    app:menu="@menu/drawer_view" /> 

</android.support.v4.widget.DrawerLayout> 
+0

Пожалуйста, разместите XML-файл. – jinkal

+0

Вот мой макет: https://drive.google.com/file/d/0B6Grnk8LmhEcWjVzclphRmxHcTA/view?usp=sharing Спасибо! – Steve123

ответ

1

Я отредактировал мой код, может он работает для вас.

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:id="@+id/main_content" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="?attr/colorPrimary" 
     app:popupTheme="@style/AppTheme.PopupOverlay" /> 


    <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:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:fitsSystemWindows="true"> 

     <FrameLayout 
      android:id="@+id/fragment_container" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_weight="1"> 


     </FrameLayout> 


     <android.support.design.widget.NavigationView 
      android:id="@+id/navigation_view" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:layout_gravity="start" 
      app:headerLayout="@layout/drawer_header" 
      app:menu="@menu/drawer_view" /> 

    </android.support.v4.widget.DrawerLayout> 


</LinearLayout> 


</android.support.design.widget.CoordinatorLayout> 
+0

Хорошо работает, спасибо за помощь! – Steve123

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