URL的TextView的Andr​​oid的活动链接 [英] Android active link of url in TextView

查看:104
本文介绍了URL的TextView的Andr​​oid的活动链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已获得来自web服务的动态文本和表示在一个TextView相同。有时TextView中具有URL如< A HREF =htt​​p://hello.com>你好< / A> 。我已经尝试使用下面的code设置文本。

I have getting dynamic text from a web service and showing the same in a TextView. Sometimes the TextView has url like <a href="http://hello.com">hello</a>. I have set the text using the following code.

textView.setText(Html.fromHtml(sampletext));

和还设置安卓自动链接=网络中的相应的XML包含的TextView 。现在,该链接显示正常的蓝色颜色和下划线,但我发现它只是一个死链接。什么也没有发生,如果我们试图单击它。我必须做的,使链接激活?

And also set android:autoLink="web" in the corresponding xml of that contains the TextView. Now the link is showing properly with blue color and underline, but I found the its just a dead link. Nothing is happening if we try to click it. What I have to do to make the link active?

推荐答案

这对我的作品:

<TextView
    android:text="www.hello.com"
    android:id="@+id/TextView01"
    android:layout_height="wrap_content" 
    android:layout_width="fill_parent"
    android:autoLink="web">
</TextView>

这篇关于URL的TextView的Andr​​oid的活动链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆