0
사용자 입력에 대한 제안 사항을 보여주는 MultiAutoCompleteTextView를 사용하고 있습니다. 항목이 하나 이상의 공백으로 구분되어있을 때만 작동하지만 새 줄 (예 : "Enter"버튼)이 구분 기호 일 때 작동하지 않습니다.MultiAutoCompleteTextView에 대해 하나 이상의 구분 기호가 사용됩니까?
코드 지금까지 (내가 몇 시간 전에 유래에서 거 같아요) :
내가 좋아하는 뭔가를 구현하기 위해 노력 SpaceTokenizer이 토큰 화 {
@Override
public int findTokenStart(CharSequence text, int cursor) {
int i = cursor;
while (i > 0 && text.charAt(i - 1) != ' ') {
i--;
}
while (i < cursor && text.charAt(i) == ' ') {
i++;
}
return i;
}
@Override
public int findTokenEnd(CharSequence text, int cursor) {
int i = cursor;
int len = text.length();
while (i < len) {
if (text.charAt(i) == ' ') {
return i;
} else {
i++;
}
}
return len;
}
@Override
public CharSequence terminateToken(CharSequence text) {
int i = text.length();
while (i > 0 && text.charAt(i - 1) == ' ') {
i--;
}
if (i > 0 && text.charAt(i - 1) == ' ') {
return text;
} else {
if (text instanceof Spanned) {
SpannableString sp = new SpannableString(text + " ");
TextUtils.copySpansFrom((Spanned) text, 0, text.length(),
Object.class, sp, 0);
return sp;
} else {
return text + " ";
}
}
}
}을 구현
공용 클래스 " ... || text.charAt (i) == '\ n'... "나는 적절하다고 생각했지만 제대로 작동하지 않았습니다.
나는 제안에 대해 매우 감사 할 것입니다!
내가 여기에 비슷한 일을하고있는 중이 야! stackoverflow.com/questions/12854336/autocompletetextview-backed-by-cursorloader – toobsco42