sathish kumar
sathish kumar

Reputation: 141

How to merge layout background to toolbar

How do I merge a layout background to the toolbar?

However, my layout background is not applicable on the toolbar. How do I make it applicable? My toolbar shows a grey color (and is turned to transparent).

This is my style.xml:

style.xml

   <style name="transparent" parent="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
        <item name="android:windowActionBarOverlay">true</item>
        <!-- Support library compatibility -->
        <item name="windowActionBarOverlay">true</item>
    </style>

app_bar.xml

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    app:theme="@style/transparent"/>

Upvotes: 1

Views: 1467

Answers (1)

sathish kumar
sathish kumar

Reputation: 141

Huff! I finally got it, Here is my code.

I just changed my Actionbar theme to default and i set background image to my CoordinatorLayout

     <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:background="@mipmap/background_image" android:fitsSystemWindows="true"
            tools:context=".MainActivity">
...
...
...
    </android.support.design.widget.CoordinatorLayout>

colors.xml

<resources>
    <color name="colorPrimary">@android:color/transparent</color>
    <color name="colorPrimaryDark">@android:color/transparent</color>
</resources>

Upvotes: 1

Related Questions