我怎样才能做到这一点?
public class ActivityTest extends Activity { public EditText edtText; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.test); WebView webView = (WebView) findViewById(R.id.webView); webView.loadUrl("file:///android_res/raw/htmlimages.html"); webView.addJavascriptInterface(new MyTest(),"Scripts"); webView.getSettings().setJavaScriptEnabled(true); webView.setWebChromeClient(new WebChromeClient()); edtText = (EditText) findViewById(R.id.edtText22);
解决方法
你可以使用fromHtml方法像这样:
String styledText = "This is <font color='red'>simple</font>."; textView.setText(Html.fromHtml(styledText));