修改AutoCompleteTextView显示与当地特殊字符结果 [英] Modify AutoCompleteTextView to show results with local special characters
问题描述
这是很难写这个问题得到妥善的话题。所以,让我自己清楚。
It was hard to write a proper topic for this issue. So, let me make myself clear.
我在做一个本地的应用程序,处理含土耳其字母(ĞÜŞİÖÇğüşıöç)数据。问题是,工业平板电脑,我必须用不用它的虚拟键盘上的字符的那些。所以,我需要它把一些字母相同的特殊AutoCompleteTextView。例如,如果客户端进入SENER到SENER应显示为下拉的结果过于文本框中。有没有连方法,我可以做到这一点?
I'm making a local app, dealing with data containing Turkish letters (ĞÜŞİÖÇğüşıöç). Problem is, the industrial tablet I must use don't have those chars on its virtual keyboard. So I need to have a special AutoCompleteTextView which treats some letters as same. For example if the client enters "sener" to the text box, "şener" should be shown as a result in the dropdown too. Is there even a way I could achieve that?
推荐答案
您有几个选择。例如,当用户键入Özgür的
,告诉他这句话土耳其字母的组合,通过更换 0
与Ò
和 U
与 U
。类似的东西。
You have a few choices. For example, when user type ozgur
, show him the combinations of this word with turkish letters by replacing o
with ö
and u
with ü
. Something like that.
private char toTurkish(char c) {
if(c == 'o') return 'ö';
if(c == 'u') return 'ü';
//...
}
private void usage() {
String word = "ozgur";
for(i = 0; i < word.length; i++) {
word.setCharAt(i, toTurkish(word.charAt(i)));
}
}
,或者创建通过增加土耳其语字典文件到您的应用程序包含土耳其单词手册列表。比较使用正则表达式时,用户类型。
Or create a manual list that contains turkish words by adding turkish dictionary file to your app. Compare using Regex when user types.
或创建键盘上方的布局,并把字母。我会选择这样的方式。无需AutoCompleteTextView。
Or create a layout above the keyboard and put the letters. I'd choose this way. No need for AutoCompleteTextView.
这篇关于修改AutoCompleteTextView显示与当地特殊字符结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!