2016-12-18 6 views
0

Я пытаюсь сделать мой activity_main под моей навигационной панелью, используя <item name="android:windowTranslucentNavigation">true</item> в моих стилях.xml и добавив android:fitsSystemWindows="true" в мои макеты. По какой-то причине, вместо того чтобы использовать все доступное пространство, расположение центров себе в свободное пространство:Макет не занимает весь экран

enter image description here

мои main_activity:

<?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" 
    tools:context="com.example.smc_kr.gachi_soundboardv2.MainActivity"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:theme="@style/AppTheme.AppBarOverlay"> 

     <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.design.widget.AppBarLayout> 

    <include layout="@layout/content_main" /> 
</android.support.design.widget.CoordinatorLayout> 

мои content_main:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 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:id="@+id/content_main" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:fitsSystemWindows="true" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context="com.example.smc_kr.gachi_soundboardv2.MainActivity" 
    tools:showIn="@layout/activity_main"> 

    <GridView 
     android:layout_width="fill_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/gridview" 
     android:numColumns="auto_fit" 
     android:verticalSpacing="0dp" 
     android:horizontalSpacing="0dp" 
     android:gravity="center" 
     android:stretchMode="columnWidth" 
     android:columnWidth="100dp"> 
    </GridView> 
</RelativeLayout> 

мои стили 21:

<resources> 

    <style name="AppTheme.NoActionBar"> 
     <item name="windowActionBar">false</item> 
     <item name="windowNoTitle">true</item> 
     <item name="android:windowDrawsSystemBarBackgrounds">true</item> 
     <item name="android:statusBarColor">@android:color/transparent</item> 
     <item name="android:windowTranslucentNavigation">true</item> 
    </style> 
</resources> 

Все значения измерений установлены в 0dp. Я что-то пропустил?

+0

Разве это не отображается кнопка вашего навигатора? – Idee

+0

@idee, если вы посмотрите на gridview, оно не занимает пространство под панелью инструментов, а половина пространства находится на панели навигации. –

+0

post content_main.xml – Idee

ответ

0

Я это исправил, заменив RelativeLayout в content_main с ScrimInsetsFrameLayout.

0

Попробуйте удалить все Прокладки в content_main.xml

+0

Я удалил все дополнения из content_main.xml, но никаких изменений. –

0

Либо удалить андроида: вес = «центр» с точки зрения сетки или сделать его верхней

+0

Пробовал оба, без изменений. –

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