2

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

4

1 回答 1

2

我会为此使用 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;
            }
        }
    };

希望能帮助到你

于 2010-10-11T13:16:53.347 回答