2016-11-30 36 views
0

後如此不同我升級我的V7程序兼容性庫25.0.0,這導致我的活動突然有這種怪異的填充或保證金左:活動看起來更新程序兼容性庫25.0.0

enter image description here

編輯:這是應該如何看待 enter image description here

我的活動延伸AppCompatActivity和這裏的視圖XML的一點點(activity_main.xml中):

<android.support.v4.widget.DrawerLayout 
android:id="@+id/drawer_layout" 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:openDrawer="start"> 

<include 
    layout="@layout/app_bar_main" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"/> 

<android.support.design.widget.NavigationView 
     android:id="@+id/nav_view" 
     android:layout_width="300dp" 
     android:layout_height="match_parent" 
     android:background="?attr/backgroundColorPrimary" 
     android:layout_gravity="start" 
     app:itemBackground="?attr/backgroundColorPrimary" 
     app:itemIconTint="?attr/foregroundColorPrimary" 
     android:fitsSystemWindows="false" 
     app:itemTextColor="?attr/foregroundColorPrimary"> 
     <include layout="@layout/nav_side_bar"/> 
    </android.support.design.widget.NavigationView> 

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

我試過在CoordinatorLayout包裹我的整個佈局和設置contentInsetLeftcontentInsetRight到0dp但仍沒有運氣......似乎只有我跑API 25(不是XL雖然)像素手機

上發生
+1

截圖是Emulator還是android設備或佈局預覽? –

+0

@AmanVerma從一個真實的設備截圖。不能在仿真器上覆制。 –

+1

@AmanVerma沒有那些界限被轉動,所以人們可以看到這個佈局是如何搞砸的。所有留下的填充不是由我添加的。 –

回答

0

使用像這樣的標準格式。這應該是適合你的。

<?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" 
     xmlns:tools="http://schemas.android.com/tools" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:fitsSystemWindows="true" 
     android:id="@+id/root"> 
     ----------------------------------------- 
     -----PUT YOUR ADDITIONAL LAYOUT HERE----- 
     ----------------------------------------- 
     <android.support.v4.widget.DrawerLayout 

      android:id="@+id/drawer_layout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:fitsSystemWindows="true" 
      tools:openDrawer="start"> 


      <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" 
       android:fitsSystemWindows="true" 
       app:headerLayout="@layout/nav_header_main" 
       app:menu="@menu/activity_main_drawer" /> 
      </android.support.v4.widget.DrawerLayout> 

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

謝謝,我試過,但這不是問題。 –