I am using the below code to add a style to RadioButtons in my app. The parent of the base theme of the app is Theme.Material3.DayNight.NoActionBar
.
Below is the code:
<style name="RadioStyle">
<item name="android:drawableStart">@drawable/mydrawable</item>
<item name="android:button">@drawable/anotherdrawable</item>
</style>
For some reason, the drawableStart
is working fine, but the button is not being displayed. I can put them manually in each radiobutton, but I want to know why it is not working in style?
Also, when I was creating a style for a button, the backgroundTint
attribute was working but the android:textColor
was not. It was working fine with Theme.AppCompat.DayNight.NoActionBar
, but not with Theme.Material3.DayNight.NoActionBar
. I had to use the colorOnPrimary
attribute instead. How to understand when which attribute is to be used in case of Material3
Library?
I tried to simulate the same and it worked perfectly. What I can understand from your code is you might have used android:theme
attribute instead of style
in the layout. If yes, then replace android:theme
by style
in the layout.