2016-11-30 22 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

谢谢,我试过,但这不是问题。 –