Android-在MultiAutoCompleteTextview Text的不同Android版本中使用Image Span替换问题

I Am adding the customized Clickable spans to my
MultiAutoCompleteTextview. After adding 2 or more Contacts in That
Edit Text. i am replacing the extra Spans to Image Span with Text
Contains Count . My problem is that count is displaying different in
lower end devices(i.e., 2.2) and higher end devices(i.e., 4.0). Please
have a look into the below Pictures.

Higher End Devices.
《Android-在MultiAutoCompleteTextview Text的不同Android版本中使用Image Span替换问题》

LOwer End Devices
《Android-在MultiAutoCompleteTextview Text的不同Android版本中使用Image Span替换问题》

高端设备存在问题.每个额外的芯片正在替换计数2次.
这是替换额外芯片的代码,PLease找到它.

void createMoreChipPlainText() {

    Editable text = getText();
    int start = 0;
    int end = start;
    for (int i = 0; i < CHIP_LIMIT; i++) {
        end = movePastTerminators(mTokenizer.findTokenEnd(text, start));
        start = end; // move to the next token and get its end.
    }
    // Now, count total addresses.
    start = 0;
    int tokenCount = countTokens(text);
    MoreImageSpan moreSpan = createMoreSpan(tokenCount - CHIP_LIMIT);
    SpannableString chipText = new SpannableString(text.subSequence(end,
            text.length()));
    chipText.setSpan(moreSpan, 0, chipText.length(),
            Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    text.replace(end, text.length(), chipText);

    mMoreChip = moreSpan;
}

android中可编辑类的替换方法是否有任何问题.任何人都对这个问题有所了解.请在这里发表您的建议

最佳答案 Android Tokenized Auto-Complete,一个新的Splitwise开源项目

please refer this link

点赞