Issue
For Theme.AppCompat, one can use android:buttonStyle
and android:imageButtonStyle
to style Button
and ImageButton
respectively for all activities. They do not seem to work for Theme.MaterialComponents
. If not, what is the equivalent for Theme.MaterialComponents
?
Could anyone shed some light on this?
The old theme example:
<style name="OnviferThemeStyle" parent="Theme.AppCompat">
...
<item name="android:buttonStyle">@style/fooButton</item>
<item name="buttonStyle">@style/fooButton</item>
<item name="android:imageButtonStyle">@style/fooImageButton</item>
<item name="imageButtonStyle">@style/fooImageButton</item>
</style>
Solution
With the MaterialComponents theme you can use the materialButtonStyle
attribute.
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
<item name="materialButtonStyle">@style/....</item>
</style>
For the ImageButton
currently there isn't a Material Components. You can still use the ImageButton
component and the imageButtonStyle
attribute.
Answered By - Gabriele Mariotti
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.