In my app I have two activities right now. The first one, LoginActivity, has Theme.AppCompat.Light.DarkActionBar
as its theme. The other one, ClientesActivity, has an <item name="windowActionBar">false</item>
and a custom android.support.v7.widget.Toolbar
. They used to behave correctly. When I updated to Build Tools 27.0.1, Gradle 3.0.1 and Support Library 27.0.2, they all started looking like this:
Here's the code:
styles.xml
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:background">#FAFAFA</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppThemeNoBar" parent="AppTheme">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
</resources>
clientes_activity.xml
<android.support.design.widget.CoordinatorLayout 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/coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/AppThemeNoBar"
tools:context="melamed.soldeloesteapp.ClientesActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/tb_clientes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar_clientes"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:title="Carrito">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<!-- Some more irrelevant stuff -->
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
Please someone tell me how to fix them back!
PS: They were blue and with white text, as any toolbar (the custom one had white buttons).
OK, I found the solution by myself while removing stuff. I discovered that from some support library version, android:background
in a style affects only the Toolbar (WTF?). I removed the <item name="android:background">#FAFAFA</item>
and it worked. Now, how can I default a background colour from a theme? (Answer in the comments, cba to make a whole new question about this)