定义textView1和textView2并获得组件。
String html = "<font color=‘red‘></font>"; html += "<a href=‘http://www.baidu.com‘>百度一下</a><br>"; // 点击的时候产生超链接 CharSequence charSequence = Html.fromHtml(html); textView1.setText(charSequence); textView1.setMovementMethod(LinkMovementMethod.getInstance()); String text ="文本域"; textView2.setText(text); textView2.setMovementMethod(LinkMovementMethod.getInstance());
添加onCreateOptionsMenu方法:
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; }
时间: 2024-11-04 19:02:48