I have an XML with a RadioGroup
and I'm programmatically adding RadioButton
to the RadioGroup
.
Nevertheless, in my RadioButtons
I want to have items with two lines text, such as Category name\nand parent category
.
Unfortunately, for some reason, the margin/padding isn't kept for the second line.
This is the way I add my button:
RadioButton radioButton = (RadioButton) item.findViewById(R.id.categoryName);
radioButton.setText(categoryName + "\n" + parentCategoryText);
This is my button in the XML:
<RadioButton
android:id="@+id/categoryName"
style="@style/mpRefineNormalText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:drawablePadding="10dp"
android:duplicateParentState="true"
android:ellipsize="end"
android:maxLines="2"
android:singleLine="false"
android:textSize="@dimen/paddingCategoryListItemTextSize"
tools:text="Category name\nand parent category"/>
How can I fix this?
Thanks a lot in advance!