Доброе время суток, прошу меня не пинать, так как только изучаю Android (Java) разработку. Есть стандартная реализация Navigation Drawer
http://recordit.co/P7RX7Meq6M
суть в том что она перекрывает шапку (header, верхнюю панель - как она правильно называется)
https://i.imgur.com/Gj8MdSA.png
необходимо сделать так, что бы меню не закрывала эту верхнюю панель
В принципе я сделал, НО у меня такое ощущение, что я сделал как то неправильно (или что то не дописал)
вот результат что у меня получилось
http://recordit.co/Ux5OiPMICT
на GIF`ке не особо хорошо видно, но меню работает корректно - как при клике по гамбургеру, так и свайпом. Проблема в том, что теперь скрыта системная панелька с часами, батарейкой, интернетом и прочим
https://i.imgur.com/rxlTw4i.png
Вот структура лаяутов
https://i.imgur.com/vVuuiro.png
файл activity_test.xml
Код:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="false"
android:theme="@style/AppTheme.AppBarOverlay"
app:expanded="false">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorPrimary"
android:padding="0dp"
app:elevation="0dp"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false"
tools:openDrawer="start">
<include layout="@layout/app_bar_test" />
<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="false"
app:menu="@menu/activity_test_drawer">
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
<Space
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
файл app_bar_test.xml
Код:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".TestActivity">
<include
layout="@layout/content_test"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.design.widget.CoordinatorLayout>
файл content_test.xml
Код:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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:visibility="gone"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".TestActivity"
tools:showIn="@layout/app_bar_test">
</android.support.constraint.ConstraintLayout>
файл nav_header_test.xml
Код:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:background="@drawable/side_nav_bar"
android:gravity="bottom"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark"
android:visibility="gone">
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/nav_header_desc"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:scaleType="fitStart"
android:visibility="gone"
app:srcCompat="@mipmap/ic_launcher_round" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:text="@string/nav_header_title"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/nav_header_subtitle" />
</LinearLayout>
Подскажите пожалуйста, что я не так сделал? Или надо все верстать самому и с нуля? Заранее спасибо!!!
Web разработчик (PHP HTML CSS SQL), в данный момент изучаю Android разработку.