I am using fromHtml for some words, but it not properly shown.Sorry my bad english.
Typeface tfArial = Typeface.createFromAsset(getAssets(), "arialtur.otf");
String yazi="Deneme "+"<strong>"+"must be bold"+"</strong>"+" kayıt.";
Spanned text1 = Html.fromHtml(yazi);
TextView aa= (TextView) findViewById(R.id.metin1);
TextView ab= (TextView) findViewById(R.id.metin2);
aa.setText(text1);
aa.setTypeface(tfArial);
ab.setText("Non arial font");
screenshot http://hizliresim.com/rd4gkV
In case of <b>
tag in resourses string you could wrap text in <![CDATA[
and ]]>
, i.e.:
<string name="textWithBold"><![CDATA[<b>BoldText</b>]]></string>
Then you could get and show it so:
textView.setText(Html.fromHtml(getString(R.string.textWithBold)));
<strong>
HTML tag is not a "styling" tag. It's here only to indicates that the content is important. The default style of the <strong>
relies on the web engine implementation.
You can have some information on these two links :
Try to use <b>
instead of <strong>
if you want a bold text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With