TextView中的超链接的text只能是网址.我现在有这样的需求,比如文字是google,然后点击就跳到google主页.我把text设置成<a href=''>google</a>发现google是web那种超链接的样式,但无法点击.想请教一下大家好有没有其他的方式解决,谢谢!

解决方案 »

  1.   

    <a href='www.google.com'>google </a>
      

  2.   

    界面xml文件中 
    <TextView android:autoLink="web"
      

  3.   

    其实不用那么复杂的。
    直接textView.setText("http://www.google.cn/");
    不过你得加上一句:
     textView.setMovementMethod(LinkMovementMethod.getInstance());
    然后在的xml中加上一句:
    android;autoLink = "all"
    就应该没有问题了
      

  4.   

    设置<TextView>标签的android:autoLink属性为web或all
      

  5.   

    顶楼上,然后textView.setText("http://www.google.cn/"); 
      

  6.   

    这样可以设置成超链接,但是在TextView中已经设置了内容,现在想把它设置成超链接,怎么做啊?
      

  7.   

    Google了一下,可以看看这篇文章,实现点击回调方法
    http://orgcent.com/android-textview-no-underline-hyperlink/