Reputation: 11
I just recently change the parent reference of my AppTheme, to have compatibility with recent tools, but now some old styles are not been applied..
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
To
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
And for example this button style is not working.
<style name="ButtonStyle" parent="@android:style/Widget.Button">
<item name="android:background">@drawable/dark_bb</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">@color/colorAccent</item>
</style>
Upvotes: 1
Views: 40
Reputation: 184
When switching from Theme.AppCompat.Light.DarkActionBar
to Theme.MaterialComponents.Light.DarkActionBar
, update your button style like this:
<style name="ButtonStyle" parent="Widget.MaterialComponents.Button">
<item name="backgroundTint">@drawable/dark_bb</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">@color/colorAccent</item>
</style>
Apply the style in your layout:
<Button
style="@style/ButtonStyle"
...
/>
This ensures compatibility with Material Components theme.
Upvotes: 0