1

I implemented a radiobutton with edittext as shown

I did this by manually placing an EditText outside the RadioGroup, adjacent to the last RadioButton and implemented a logic to get the value of editext when the last RadioButton is selected. Now I want to make a custom RadioButton with this functionality that is also compatible with the radio group. My approach has been to inflate the EditText inside the RadioButtonand then use it in a RadioGroup but no luck so far.

Any suggestions with this approach or any different approach are appreciated!

Sajal Jain
  • 76
  • 4
  • https://stackoverflow.com/questions/10461005/how-to-group-radiobutton-from-different-linearlayouts, looks like it would require a custom RadioGroup class, but that solution does work – Amin Mar 17 '21 at 19:39
  • To accomplish what you intended, you have to code two custom classes which are RadioButton and RadioGroup. Because default radio group accepts only RadioButton children and you cannot implement custom radioButton containing an edit text by extending default class. Default RadioButton class is a compound button so it is a button and does not accept an edit text. You should go with your current approach to avoid complexity, if you don't use it extensively in your project. – M.ekici Mar 25 '21 at 09:38

0 Answers0