I could click on the radioButton in the radioGroup, "upto" the text area displayed after the radioButton but not in the empty space after the text area. Is there a way to make it clickable as well?
I think I have explained the problem clearly, if not please do let me know.˙
Following are the details.
styles.xml
<style name="RBStyle" parent="@android:style/Widget.CompoundButton.RadioButton">
<item name="android:drawable">@drawable/button_background</item>
<item name="android:paddingLeft">4dp</item>
</style>
rb_layout.xml
<RadioButton style="@style/RBStyle" />
Sample code
RadioButton radioButton = (RadioButton) layoutInflater.inflate(
buttonResource, null);
radioButton.setText(buttonName);
radioButton.setId(buttonId);
Posting answer for brevity. Adding LinearLayout params and adding it to radioGroup.addView(...) fixed it.
LinearLayout.LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
radioGroup.addView(radioButton, layoutParams);