Andriod控件之TextView
private TextView textview1,textview2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textview1=(TextView)this.findViewById(R.id.textView1); textview2=(TextView)this.findViewById(R.id.textView2); //定义一段html 代码 String html="<font color=red>我喜欢andriod</font></br>"; html+="<font color='#0000ff'><big><I>我喜欢andriod</I></big></font><p>"; html+="<big><a herf='http://www.cnblogs.com/llyfe2006/'>博客</a></big>"; //Html.fromHtml(html); textview2.setText(Html.fromHtml(html)); //实现超链接的效果:点击的时候产生超链接 textview2.setMovementMethod(LinkMovementMethod.getInstance()); String text="我的博客URL:http://www.cnblogs.com/llyfe2006\n"; text+="我的email:110@qq.com\n"; textview1.setText(text); textview1.setMovementMethod(LinkMovementMethod.getInstance()); }