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"/>
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.
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.”
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.”
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) ?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With