Skip to content

Instantly share code, notes, and snippets.

@sheerazam
Created April 11, 2016 09:01
Show Gist options
  • Select an option

  • Save sheerazam/58d689431895f500126843ed15ab1169 to your computer and use it in GitHub Desktop.

Select an option

Save sheerazam/58d689431895f500126843ed15ab1169 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<!-- The important thing to note here is the added fitSystemWindows -->
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/my_drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
>
<!-- Your normal content view -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- The rest of your content view -->
<FrameLayout
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000"
/>
<!-- We use a Toolbar so that our drawer can be displayed
in front of the action bar -->
<include
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
android:background="@android:color/transparent"
layout="@layout/toolbar" />
</FrameLayout>
<!-- Your drawer view. This can be any view, LinearLayout
is just an example. As we have set fitSystemWindows=true
this will be displayed under the status bar. -->
<LinearLayout
android:layout_width="304dp"
android:layout_height="match_parent"
android:layout_gravity="left|start"
android:fitsSystemWindows="true">
<!-- Your drawer content -->
<FrameLayout
android:id="@+id/drawer_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/my_awesome_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
app:theme="@style/ThemeOverlay.AppCompat.ActionBar"
android:background="@android:color/transparent"
>
<!-- android:background="#ff1f5973" -->
<RelativeLayout
android:id="@+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/btnToggleToolbar"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/menu"
style="?android:attr/borderlessButtonStyle"
/>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pick Up Location"
android:textSize="20sp"
android:textColor="#fff"
android:layout_centerHorizontal="true"
/>
</RelativeLayout>
</android.support.v7.widget.Toolbar>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment