Reputation: 1020
First thing first I have no problem that drawer is not under status bar and problem of that sort . That is working fine.
Second we have a great option of showing transparent status bar with image behind it using Collapsing Toolbar . E.g -
Here you can see that status bar is transparent .
Now if I use the DrawerLayout instead of Cordinator one , (where Coordinator is direct child of DrawerLayout) I get this result -
Here is my code snippet -
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".Dashboard">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="300dp"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsingToolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="32dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="@+id/toolbarImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.7"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
android:src="@drawable/morning_1"
app:layout_collapseMode="parallax" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/activity_dashboard_greeting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"
android:text="Good Morning !!"
android:textColor="@color/white"
android:textSize="28dp" />
<com.meg7.widget.CircleImageView
android:id="@+id/activity_dashboard_image"
android:layout_width="88dp"
android:layout_height="88dp"
android:layout_below="@+id/activity_dashboard_greeting"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:src="@drawable/arrow_expense" />
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_dashboard" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_margin="@dimen/activity_horizontal_margin"
android:src="@drawable/ic_add"
app:layout_anchor="@+id/appBar"
app:layout_anchorGravity="bottom|right" />
</android.support.design.widget.CoordinatorLayout>
<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/nav_header"
app:menu="@menu/menu_navigation">
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
Do note that even though first image is of different activity the exact same is happening in second one .
Your time is appreciated . Thanks in advance .
Upvotes: 2
Views: 626