Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change toolbar color

I've been searching how to customize the toolbar, for example how to add background color, but I don't understand how it works.

I've been trying to add a custom style for my toolbar but any result ...

The Manifest

<application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/Theme.Design">

The style.xml file

<resources>

    <style name="Theme.Design" parent="Base.Theme.Design">
    </style>

    <style name="Base.Theme.Design" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">@color/red</item>
        <item name="colorPrimaryDark">@color/red</item>
        <item name="colorAccent">@color/red</item>
        <item name="android:textColorPrimary">@color/white</item>
        <item name="android:windowActionBarOverlay">true</item>
        <item name="windowActionBarOverlay">true</item>
    </style>    
    ...

And the toolbar in layout

<android.support.v7.widget.Toolbar
            android:id="@+id/home_toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"/>
like image 978
Selorbis Avatar asked Aug 26 '15 21:08

Selorbis


People also ask

Why cant I change the color of my taskbar?

If you're trying to modify the accent color of Start and Taskbar only to find out that the option is greyed out, it's most likely because you're using Light Mode – this mode can't take advantage of this customization menu. Next, in the left-side list search for Personalization and click on it, then click on Colors.

How do I change the color of the menu bar in Windows 10?

In “Settings,” click “Personalization.” In “Personalization” settings, select “Colors” in the sidebar. In “Colors” settings, click the “Choose your color” drop-down menu and select “Custom.”

Can I change taskbar color Windows 11?

First, open the Settings app by pressing Windows+i on your keyboard. Or you can right-click the taskbar and select “Settings” in the menu that appears. In Settings, click “Personalization” in the sidebar, then select “Colors.”


1 Answers

Thanks, but any solution works.

 <android.support.v7.widget.Toolbar
            android:id="@+id/home_toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"/>

or

toolbar.setBackgroundColor(Color.parseColor("#80000000"));

May be because my toolbar is in android.support.design.widget.CoordinatorLayout (to put a android.support.design.widget.FloatingActionButton) ?

like image 164
Selorbis Avatar answered Sep 20 '22 17:09

Selorbis