MaterialButton backgroundTint ignored on API level 19
See original GitHub issueOverview
Have a custom theme overriding Theme.MaterialComponents.Dark and custom Widget.MaterialComponents.Button style overriding button text color.
Reproduction steps
Primary Color variants are shades of dark blue. The theme editor in Android Studio displays the button preview correctly, the buttons work correctly in API level 21+ but background is completely ignored on API level 19.
In styles.xml
<style name="AppTheme.Dark" parent="Theme.MaterialComponents">
<item name="colorAccent">@color/colorWhite</item>
<item name="colorControlNormal">@color/colorWhiteTranslucent88</item>
<item name="colorControlActivated">@color/colorWhite</item>
<item name="colorControlHighlight">@color/colorPrimaryDark</item>
</style>
<style name="Widget.AppComponents.Button" parent="Widget.MaterialComponents.Button">
<item name="rippleColor">@color/colorPrimary</item>
<item name="android:textColor">@color/colorPrimary</item>
</style>
Operating system and device
Emulator running API level 19 and API level 21
Android Studio theme preview:
App running in emulator 21:
App running in emulator 19:
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Android material button set icon and background color not ...
I am using a custom style in order to change the button's background color. I have also tried directly adding the backgroundTint property...
Read more >MaterialButton - Android Developers
A convenience class for creating a new Material button. This class supplies updated Material styles for the button in the constructor.
Read more >Migrating to Material Components for Android
The 'Refactor> Migrate to AndroidX' tool in Android Studio will refactor your Design Support Library dependency to MDC. Note: Jetpack and MDC ...
Read more >Visualization: Column Chart - Google Developers
For a horizontal version of this chart, see the bar chart. ... You load the Google Visualization API (although with the 'bar' package...
Read more >Xamarin.Forms 4.6.0.1073 (4.6.0 Service Release 5) Release ...
Forms 4.6.0.847 (4.6.0 Service Release 3); Tuesday, May 19, ... with target API level 29 or 30" (#10975) (added in 4.6.0.967 (4.6.0 Service ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have just found out that if you specify rippleColor then the backgroundTint is ignored and the rippleColor is used as the background color instead.
In July 2019 the issue is still not fixed, dont wanna use alpha version of Material library https://mvnrepository.com/artifact/com.google.android.material/material
So I found a workaround. Create your custom style for material buttons:
then set it your MaterialButton like this
android:theme="@style/MaterialButton"