在 Eclipse 中测试自动完成文本控件时,我无法在三星手机上显示软键盘。我点击物理触摸自动完成文本控件以调出键盘。不允许显示软键盘的 AutoCompleteText 控件有什么不同吗?下面是我活动的 onCreate 方法中的代码。我将不胜感激。
autoComplete = (AutoCompleteTextView) findViewById(R.id.suggest);
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(autoComplete, InputMethodManager.SHOW_FORCED);
if (imm != null){
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
}
// imm.toggleSoftInput(0, 0);
autoComplete.addTextChangedListener(new TextWatcher(){
public void afterTextChanged(Editable editable) {
// TODO Auto-generated method stub
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
// TODO Auto-generated method stub
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
String newText = s.toString();
int len = newText.length();
// Toast.makeText(getApplicationContext(), "Text changed count = " + String.valueOf(len), Toast.LENGTH_LONG).show();
if(len > 1)
new getData().execute(newText);
}
});