本文介绍了机器人:机器人:自动链接="网络"不支持.ME域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我设置一个TextView为:

I have a TextView that I set as:

android:autoLink="web"

但是,当我添加以下文字:

But when I add the following text:

TextView text = (TextView) findViewById(R.id.TextView01);
        text.setText("Test\n" +
           "http://www.domain1.net\n" +
           "\n" +
           "http://www.domain2.me\n"");

只有第一个站点被盗链,因为另外一个是.ME

Only the first domain is hotlinked, since the other one is .me

有没有办法来指定自动链接正确的URL?

Is there a way to specify the correct urls for autoLink ?

谢谢!

推荐答案

发现问题。

我使用的是2.1模拟器,并且似乎域不支持回来时,2.1发布。在2.2的链接看起来不错。

I was using a 2.1 emulator, and it seems that domain was not supported back when 2.1 was released.On 2.2 the link looks fine.

我下载Android源代码,看看他们是如何做到这一点,这是我发现了什么:

I download the Android source to see how they do it and this is what I found:

    /**
 *  Regular expression to match all IANA top-level domains for WEB_URL.
 *  List accurate as of 2010/02/05.  List taken from:
 *  http://data.iana.org/TLD/tlds-alpha-by-domain.txt
 *  This pattern is auto-generated by frameworks/base/common/tools/make-iana-tld-pattern.py
 */
public static final String TOP_LEVEL_DOMAIN_STR_FOR_WEB_URL =
    "(?:"
    + "(?:aero|arpa|asia|a[cdefgilmnoqrstuwxz])"
    + "|(?:biz|b[abdefghijmnorstvwyz])"
    + "|(?:cat|com|coop|c[acdfghiklmnoruvxyz])"
    + "|d[ejkmoz]"
    + "|(?:edu|e[cegrstu])"
    + "|f[ijkmor]"
    + "|(?:gov|g[abdefghilmnpqrstuwy])"
    + "|h[kmnrtu]"
    + "|(?:info|int|i[delmnoqrst])"
    + "|(?:jobs|j[emop])"
    + "|k[eghimnprwyz]"
    + "|l[abcikrstuvy]"
    + "|(?:mil|mobi|museum|m[acdeghklmnopqrstuvwxyz])"
    + "|(?:name|net|n[acefgilopruz])"
    + "|(?:org|om)"
    + "|(?:pro|p[aefghklmnrstwy])"
    + "|qa"
    + "|r[eosuw]"
    + "|s[abcdeghijklmnortuvyz]"
    + "|(?:tel|travel|t[cdfghjklmnoprtvwz])"
    + "|u[agksyz]"
    + "|v[aceginu]"
    + "|w[fs]"
    + "|(?:xn\\-\\-0zwm56d|xn\\-\\-11b5bs3a9aj6g|xn\\-\\-80akhbyknj4f|xn\\-\\-9t4b11yi5a|xn\\-\\-deba0ad|xn\\-\\-g6w251d|xn\\-\\-hgbk6aj7f53bba|xn\\-\\-hlcj6aya9esc7a|xn\\-\\-jxalpdlp|xn\\-\\-kgbechtv|xn\\-\\-zckzah)"
    + "|y[etu]"
    + "|z[amw]))";

因此​​,似乎每个版本从IANA的最新领域GOOGLE更新

So it seems on each release GOOGLE updates from iana the latest domains

这篇关于机器人:机器人:自动链接="网络"不支持.ME域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 03:15