0

I have been trying to make my toolbar to be translucent and overlay the main activity content. As of now the toolbar background changes to white background. Can someone tell me what I am missing here. enter image description here Below is the MainActivity

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"

android:background="@color/colorWhite"
tools:context="com.netbigs.apps.moviesat.MainActivity">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <LinearLayout
        android:id="@+id/container_toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <include
            android:id="@+id/toolbar"
            layout="@layout/toolbar" />
    </LinearLayout>


    <RelativeLayout
        android:id="@+id/content_frame"

        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>

<ListView
    android:id="@+id/left_drawer"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:background="@color/colorPrimary"
    android:choiceMode="singleChoice"
    android:divider="@android:color/background_dark"
    android:dividerHeight="1dp" >
</ListView>
</android.support.v4.widget.DrawerLayout>

Toolbar.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar 
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" 
android:layout_height="match_parent"
android:id="@+id/toolbar"
android:background="@null>

This is what iam trying to achieve. enter image description here

1 Answers1

0

just add these below following lines to your android activity style :

<item name="colorPrimary">@android:color/transparent</item>
<item name="windowActionBarOverlay">true</item>
Nima Mohammadi
  • 353
  • 2
  • 9