0

I need to dynamically change the text in the drawable of a RadioButton. It should look something like this

enter image description here

Where the A should be able to change.

My first thought was to set a shape-drawable background to a TextView (to get the border around the A) and use that layout in the RadioButton. But I haven't found a way to do that. All I can find is to set drawables/shapes/selectors to a RadioButton, not to set an actual TextView layout.

Any ideas how to go about this?

Algar
  • 5,734
  • 3
  • 34
  • 51
  • you will likely have to create your own custom view – Vladyslav Matviienko May 30 '18 at 08:38
  • Indeed. I'm trying but doesn't get it to work, so I turned to here :). – Algar May 30 '18 at 08:39
  • 1
    without a custom view, you can do it. Keep a framelayout and take two child in it one is radio button with custom background and other is TextView aligned to center. You can look for Framelayout examples also. – Pankaj Kumar May 30 '18 at 08:42
  • Do you have an example of this? – Algar May 30 '18 at 09:15
  • Turns out I solved it with a ListView instead. I just keep track of the current pressed view and update the items accordingly. I'll leave this question open if someone cracks a RadioButton solution. – Algar May 30 '18 at 12:02

0 Answers0