TextView的是linkified和可选? [英] TextView that is linkified and selectable?

查看:92
本文介绍了TextView的是linkified和可选?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想有一个的TextView ,既选择和linkified。当我做这两个我结束了可选择的文本链接,但不能点击。

编辑:

我会表现出code与我很难解释:

 的TextView TextView的= view.findViewById(R.id.mytext);
    textView.setText(我的文字:4412345678前往网站:www.google.com等等等等);
    Linkify.addLinks(TextView的,Linkify.ALL);

    如果(Build.VERSION.SDK_INT> = Build.VERSION_ codeS.HONEYCOMB){
        textView.setTextIsSelectable(真正的);
    }
 

解决方案

你有没有尝试添加这对你的TextView XML code?

 <的TextView
    ...
    机器人:自动链接=所有
    机器人:textIsSelectable =真/>
 

我试过在我的code,我可以对网页/邮件呼叫/冲浪,还可以选择所有文本。

I would like to have a TextView that is both selectable and linkified. When I do both I end up with selectable text but links can't be clicked.

EDIT:

I'll show the code to explain with what I struggle:

    TextView textView = view.findViewById(R.id.mytext);
    textView.setText("My text: +4412345678 Go to website: www.google.com Blah blah");
    Linkify.addLinks(textView, Linkify.ALL);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        textView.setTextIsSelectable(true);
    }

解决方案

Did you try to add this on your TextView xml code?

    <TextView
    ...
    android:autoLink="all"
    android:textIsSelectable="true" />

I've tried it on my code and i can make a call/surf on web/mail and also select all text.

这篇关于TextView的是linkified和可选?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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