When you make buttons on Android. Is there a button to write text and images together?

Asked 2 years ago, Updated 2 years ago, 142 views

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?

image android text button

2022-09-22 22:33

1 Answers

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.


2022-09-22 22:33

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.