1

I want to override appcompat action bar style, I do this:

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>

    <item name="android:actionBarStyle">@style/MyActionBar</item>
</style>

 <style name="MyActionBar" parent="android:style/Theme.Holo.Light.DarkActionBar">
    <item name="android:background">@android:color/black</item>

but this doesn't apply to the element, this is an XML element:

  <android.support.v7.widget.Toolbar
    android:id="@+id/toolbar_bottom"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    />

Your help will be appreciated, Thank you

Atef Hares
  • 4,715
  • 3
  • 29
  • 61

2 Answers2

0

use local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"

for more details refer https://dzone.com/articles/getting-started-with-android-app-and-material-desi

bhaskar kurzekar
  • 238
  • 2
  • 14
0

Set Activity theme to this style

 <style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

In your xml your toolbar should be created in AppBarLayout

  <android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/MyTheme"
    app:elevation="0dp"
    app:popupTheme="@style/AppTheme.PopupOverlay">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        android:theme="@style/MyTheme"
        app:popupTheme="@style/AppTheme.PopupOverlay"/>


</android.support.design.widget.AppBarLayout>

MyTheme should have parent ThemeOverlay.AppCompat.Dark.ActionBar

  <style name="MyTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
//customize toolbar here`</style>

`

 <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
Clasence
  • 181
  • 1
  • 6