【问题标题】:android Linkify first occurrence onlyandroid Linkify 仅第一次出现
【发布时间】:2010-07-20 17:59:30
【问题描述】:

我正在使用带有自定义 TransformFilter 的 Linkify。是否可以告诉 linkify 只匹配我的模式的第一次出现?

【问题讨论】:

    标签: android linkify


    【解决方案1】:

    我会为此使用 MatchFilter,就像这样

       MatchFilter matcher = new MatchFilter() {
            boolean firstTime;
            @Override
            public boolean acceptMatch(CharSequence s, int start, int end) {
                if(firstTime) {
                    return true;
                    firstTime = false;
                } else {
                    return false;
                }
            }
        };
    

    希望对你有帮助

    【讨论】:

      猜你喜欢
      • 2016-12-15
      • 1970-01-01
      • 1970-01-01
      • 2014-01-28
      • 2015-06-16
      • 2018-02-05
      • 1970-01-01
      • 2023-01-08
      • 2019-10-30
      相关资源
      最近更新 更多