I'm trying to dynamically change the image of the button image. There's text above the image.
At this time, if you use ImageButton
, you can't add text, and if you use Button
, android:drawableBottom
in the xml property, but this doesn't overlap the text with the image.
All I want to do is overlap. I kept looking for ways to override draw()
on Button or ImageButton, but it was too difficult on my level. Isn't there an easy way for me to do it?
There is a way to sing setBackgroundDrawable()
in the Button instance. If you set the background drawable, the background image will be applied under the characters.
Or you can add android:background
to the button property in xml.
© 2024 OneMinuteCode. All rights reserved.