Rich Text Box in android

后端 未结 3 1743
眼角桃花
眼角桃花 2021-01-06 06:30

Is there any control in android which we can use as a rich text box which can handle formatting of characters such as bold, italic etc. and use fonts and color ?

If

3条回答
  •  盖世英雄少女心
    2021-01-06 07:06

    Sample SpannableString and TextView implementation:

    TextView tv = new TextView;
    String text = "String String String String body";
    SpannableString spannableStr = new SpannableString(text);
    spannableStr.setSpan(new StyleSpan(Typeface.BOLD), 0 , 10, 0);
    tv.setText(spannableStr);
    

提交回复
热议问题