【问题标题】:How to exclude certain numbers from autolinking within Android TextView如何从 Android TextView 中的自动链接中排除某些数字
【发布时间】:2011-12-22 16:54:06
【问题描述】:

我有一个 TextView 在我的 Android 应用程序中显示大文本。该文本包含一些电话号码,但也包含一些其他号码。 TextView 的autoLink 属性设置为ALL

目前,无论是否是电话号码,每一个看起来像电话号码的号码都会自动关联。

所以我想知道是否有办法从同一个 TextView 内的自动链接中排除某些数字?

【问题讨论】:

    标签: android textview autolink


    【解决方案1】:

    不要使用autoLink,而是将Linkify 与您自己的MatchFilterTransformFilter 一起使用。您可能可以查看Linkify 的源代码并查看它们如何定义sPhoneNumberTransformFilter 并创建您自己的修改版本。

    【讨论】:

    • 谢谢,我去看看。
    猜你喜欢
    • 2014-01-30
    • 1970-01-01
    • 2015-12-29
    • 1970-01-01
    • 1970-01-01
    • 2015-09-15
    • 2016-09-20
    • 2023-03-10
    相关资源
    最近更新 更多