在利用textview显示文字时,想实现html的效果,实现方法是:
@Override
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView textView=(TextView)findViewById(R.id.hello); textView.setText(Html.fromHtml("Hello <b>World</b>,<font size=\"3\" color=\"red\">AnalysisXmlActivty!</font>")); }
效果是:
原文: