I am developing the latest version of the SDK (API 21) and Support Library 21.0.2, and I had problems trying to implement new material design guidelines.
Material Design says that I need to have primary color and my accent color and apply them on top of my application. But sometimes, when I open the application, the primary color becomes transparent in some widgets, it returns to its normal state until I close the application (using the "Back" button) and start it again.
Here is an example of primary color transparency in my toolbar.

I use Teal 500 as the primary color, and as you can see, it is transparent only in android.support.v7.widget.Toolbar . This also happens on my Navigation Drawer and (sometimes, sometimes not) in other random widgets.
This is my toolbar.
<android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/primary" android:minHeight="?attr/actionBarSize" app:theme="@style/ThemeOverlay.AppCompat.ActionBar" >
I tried with @color/primary and ?attr/colorPrimary without success.
Here is my Theme (I don't know if this is related, but just in case):
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/primary</item> <item name="colorPrimaryDark">@color/primary_dark</item> <item name="colorAccent">@color/accent</item> <item name="colorAccent">@color/accent</item> <item name="android:textColorPrimary">#fff</item> <item name="windowActionModeOverlay">true</item> <item name="android:textViewStyle">@style/Widget.TextView.White</item> </style>
This only happens when primary color , accent color excellent. My device is running 4.2.2, and I have not tested it on other devices yet.
Toolbar Actions
<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <android.support.v7.widget.Toolbar android:id="@+id/my_awesome_toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/colorPrimary" android:minHeight="?attr/actionBarSize" app:theme="@style/ThemeOverlay.AppCompat.ActionBar" /> <FrameLayout android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:ignore="MergeRootFrame" /> </LinearLayout> <LinearLayout android:id="@+id/navdrawer" android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="start" android:fitsSystemWindows="true" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingLeft="16dp" android:paddingRight="16dp" android:paddingBottom="16dp" android:orientation="vertical" android:background="@color/primary" > </LinearLayout> <ListView android:id="@+id/left_drawer" android:layout_height="match_parent" android:layout_width="match_parent" android:background="@color/black_light" android:divider="@color/grey" android:choiceMode="singleChoice" /> </LinearLayout> </android.support.v4.widget.DrawerLayout>
android android-5.0-lollipop material-design appcompat android-theme
peguerosdc
source share