Android-问题与图片跨度更换不同的Andr​​oid版本为MultiAutoCompleteTextview文本 [英] Android- Issue with Image Span Replacement in different android versions for the MultiAutoCompleteTextview Text

查看:116
本文介绍了Android-问题与图片跨度更换不同的Andr​​oid版本为MultiAutoCompleteTextview文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加了自定义的可点击的跨度对我   MultiAutoCompleteTextview。加入2或更多联系人在这之后   编辑文本。我取代了额外的跨度为图像跨度文本   包含计数。我的问题是计数显示在不同的   较低的终端设备(即2.2)和更高的终端设备(即4.0)。请   看看到下面的图片。

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.

低端设备   

LOwer End Devices

所以,问题更高端的设备。每个额外的芯片取代数的2倍。 这里是code更换额外的芯片请找到它。

So problem with Higher end devices. each extra chip is replacing the count 2 times. Here is the code for replacing the extra chip PLease find it.

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;
}

有没有用替换法编辑类机器人的任何问题。任何一个有关于这个问题的任何想法。请在这里发表您的建议

Is there any issue with replace method for editable class in android. Any one have any idea about this issue. please post your suggestions here

推荐答案

Android的记号化自动完成,一个新的Splitwise开源项目

Android Tokenized Auto-Complete, a New Splitwise Open-Source Project

<一个href="http://blog.splitwise.com/2013/09/24/android-tokenized-auto-complete-a-new-splitwise-open-source-project/"相对=nofollow>请参考以下链接

这篇关于Android-问题与图片跨度更换不同的Andr​​oid版本为MultiAutoCompleteTextview文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆