WEB开发网
开发学院手机开发Android 开发 通过改写ArrayAdapter 用AutoCompleteTextView 实... 阅读

通过改写ArrayAdapter 用AutoCompleteTextView 实现汉字和拼音双向关联

 2010-07-15 20:43:00 来源:WEB开发网   
核心提示:@Overrideprotected void publishResults(CharSequence constraint, FilterResults results) {mObjects = (List) results.values;if (results.count > 0) {notifyDataSe

@Override

protected void publishResults(CharSequence constraint, FilterResults results) {

mObjects = (List) results.values;

if (results.count > 0) {

notifyDataSetChanged();

} else {

notifyDataSetInvalidated();

}

}

}

}

复制代码

调用代码如下:

cAdapter = new CityAdapter(this,android.R.layout.simple_dropdown_item_1line, 汉字数组,拼音数组);

autoView.setAdapter(cAdapter);

autoView.setThreshold(1);

//其中 autoView 为 AutoCompleteTextView

上一页  4 5 6 7 8 9 

Tags:通过 改写 ArrayAdapter

编辑录入:coldstar [复制链接] [打 印]
赞助商链接