TextView的超链接
来源:互联网 发布:杭州可赛锐尔网络诈骗 编辑:程序博客网 时间:2024/05/29 15:29
先放图。
TextView 中超链接有以下几种方法。
1,自动识别连接
<!-- android:autoLink="web"-设置自动识别链接,值web为匹配Web网址 -->
<!--android:autoLink="phone"-设置自动识别链接,值phone为匹配电话号码 -->
<!-- android:autoLink="email"-设置自动识别链接,值email为匹配Email地址 -->
<!-- android:autoLink="all"-设置自动识别链接,值all为匹配所有 -->
2,HTML 解析。
TextView textView =(TextView)findViewById(R.id.tvAutoLink); textView.setText(Html.fromHtml("2,百度: <a href='http://www.baidu.com'>http://www.baidu.com</a>"));
<TextView android:id="@+id/tvAutoLink" android:textSize="20dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:autoLink="all" android:text="" />
3,引用String连接。
注意还要在Activity中引用
<TextView android:id="@+id/account_register_prompt_textView" android:textSize="20dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/ACCOUNT_REGISTER_PROMPT_AGREEMENT" />
</pre><pre name="code" class="html"><pre name="code" class="html"> <string name="ACCOUNT_REGISTER_PROMPT_AGREEMENT">3,点击注册,表示同意<a href="http://www.baidu.com">服务协议</a></string>
</pre><pre name="code" class="html"><pre name="code" class="java">TextView textView1 =(TextView)findViewById(R.id.account_register_prompt_textView); textView1.setMovementMethod(LinkMovementMethod.getInstance());
转载保留原链接:http://blog.csdn.net/u011368551/article/details/41643605
0 0
- TextView的超链接问题
- TextView的超链接
- TextView的超链接
- TextView的超链接
- TextView超链接
- Textview超链接
- 设置TextView中文字的超链接
- android TextView中超链接的事件捕捉
- android TextView实现html的超链接
- TextView中超链接功能的实现
- 四种实现Textview超链接的方式
- TextView设置超链接的那些坑
- TextView:超链接的样式与跳转
- 如何编写带有超链接的TextView?
- Android TextView实现超链接
- Android TextView 超链接
- TextView 处理 超链接
- textView 添加超链接
- 高并发Tomcat7.0配置
- 机器学习之决策树
- 优先级反转及解决办法
- 实现手机来电铃声,通知铃声、警告铃声等音频定制化功能(三,多媒体扫描结果定制处理)
- 更新插件的时候报错,及解决方法
- TextView的超链接
- 【学渣的奋斗之路】【汇编语言】 2.1~2.3
- 虚拟机上加载硬盘
- android有效解决加载大图片内存溢出的问题
- android 一个简单的CardView的 使用
- Commons-fileupload组件上传中文文件名乱码问题
- TCP长连接的思考和相关问题的实验_百万链接数测试_百万链接内核参数的调整
- C# 小叙 Encoding (一)
- 正则表达式–零宽断言详解