StefMa
StefMa

Reputation: 3434

Android Toolbar: Light.DarkActionBar

I use the new Toolbar in my Android App. I want the same behauviour theme like "Light.DarkActionBar". So that my content background are white. The textes etc. are black. And my ActionBar/Toolbar have a custom background and also white Textes and Overflow-Menus. So I implement these in my styles.xml:

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

The Toolbar implementation loks like that:

<android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/primaryColor"
        app:minHeight="?attr/actionBarSize"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
        app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />

But it looks not like a want. The Toolbar-Text and the Toolbar back-Button (getSupportActionBar().setDisplayHomeAsUpEnabled(true)) looks still black!!! Want I doing wrong?

Upvotes: 4

Views: 1700

Answers (1)

StefMa
StefMa

Reputation: 3434

Ok, I found the bug. The

xmls:app

namenspace had the wrong URI. It was

xmlns:app="http://schemas.android.com/tools"

for whatever reason... I changed it to the right one:

xmls:app="http://schemas.android.com/apk/res-auto"

Now it works like I want.

Upvotes: 1

Related Questions