Original address: http://www.cnblogs.com/sunzn/p/3406013.html
Link styles, click events, and href styles are supported by links to TextView added in this way, with the following code:
Package Cn.sunzn.tlink;import Android.app.activity;import Android.os.bundle;import android.text.html;import Android.text.spanned;import Android.text.method.linkmovementmethod;import Android.view.menu;import Android.widget.textview;public class Mainactivity extends Activity { protected void onCreate (Bundle Savedinstancestate) { super.oncreate (savedinstancestate); Setcontentview (r.layout.activity_main); TextView TV_SUNZN = (TextView) Findviewbyid (R.ID.TV_SUNZN); Tv_sunzn.setmovementmethod (Linkmovementmethod.getinstance ()); spanned text = html.fromhtml ("Blog Park homepage: <a href=\" http://www.cnblogs.com/kabu/">kabu</a>"); Tv_sunzn.settext (text); } public boolean Oncreateoptionsmenu (Menu menu) { getmenuinflater (). Inflate (R.menu.main, menu); return true; }}
One way to add links under Android programming TextView