Is it possible to add a text hint inside a radio button, as opposed to adding regular text next to it? Using the hint setting on the gui builder does not work.
Asked
Active
Viewed 1,118 times
3

Lins Louis
- 2,393
- 2
- 25
- 30

lll
- 173
- 15
-
Hint? It is something meant for `EditText`. Why normal text doesn't work for you? – Rohit5k2 Feb 04 '16 at 19:53
-
i want to put 11 radio buttons in a row, when i put the text normally, they dont fit, if i can get text inside, they will. I tried resizing, but then text is too small – lll Feb 04 '16 at 20:16
-
For me it looks like Two text views in linear vertical linear layout with radio button without text. It's just 3 widgets instead of one. – Rafal Sep 30 '16 at 09:10
-
This is what you need: https://stackoverflow.com/a/33226886/11162243 – Alexander Gapanowich Oct 22 '19 at 08:25
1 Answers
1
This is the solution i found working..
if (Build.VERSION.SDK_INT<24) {
radio_button.setText(Html.fromHtml("<b><font color='"+ Color.BLACK+"'>"+getString(R.string.title)+ "</font></b>" + "<br />" +
"<small> <font color='"+Color.GRAY+"'>" + getString(R.string.description)+"</font></small>" + "<br />"
));
}else
{
radio_button.setText(Html.fromHtml("<b><font color='"+ Color.BLACK+"'>"+getString(R.string.title)+ "</font></b>" + "<br />" +
"<small> <font color='"+Color.GRAY+"'>" + getString(R.string.description)+"</font></small>" + "<br />"
),Html.FROM_HTML_MODE_LEGACY);
}

Lins Louis
- 2,393
- 2
- 25
- 30
-
1and instead of the if condition, you may use: HtmlCompat.fromHtml(htmlCode,HtmlCompat.FROM_HTML_MODE_LEGACY) – Esmail Elhanash Dec 16 '21 at 10:24