Changing text color in a WebView?

后端 未结 8 571
梦如初夏
梦如初夏 2020-12-17 09:06

There\'s a method for altering background color but not font.
Any ideas?

8条回答
  •  无人及你
    2020-12-17 09:36

    When the buffer is SPANNABLE, modifying the HTML directly is an ideal solution. The font, color, typeface, style can all be affected through HTML:

    String szMessage = "click me";
    
    TextView tv = (TextView)findViewById(R.id.tv_message);
    tv.setText(Html.fromHtml(szMessage), BufferType.SPANNABLE);
    

提交回复
热议问题