是否有其他人知道如何解决Sony Tablet S上非常恼人的问题。
我有一个垂直的ScrollView和一个包含大量TextView和一些EditTexts的线性布局。当我向下滚动屏幕并进入EditText时,设备决定给出EditText焦点并弹出键盘。
在其他设备上不会发生这种情况,例如华硕Transformer Prime,HTC One X,三星Galaxy Tab和HP TouchPad(cyanogenmod)。
我做过的事情。
这绝对是索尼平板电脑特有的问题!
其他人有这个问题和解决方案吗?
由于
答案 0 :(得分:2)
在EditText上添加一个eventListener,当它获得焦点然后隐藏键盘
使用这个:
InputMethodManager mgr = (InputMethodManager) getSystemService(
Context.INPUT_METHOD_SERVICE);
mgr.hideSoftInputFromWindow(editText.getWindowToken(), 0);
获得焦点增益事件使用此功能
imageView.setOnFocusChangeListener(
new OnFocusChangeListener() {
public void onFocusChange(View arg0, boolean arg1) {
// hide the keyboard using above code
InputMethodManager mgr = (InputMethodManager) getSystemService(
Context.INPUT_METHOD_SERVICE);
mgr.hideSoftInputFromWindow(editText.getWindowToken(), 0);
}
});
希望它会有所帮助。
答案 1 :(得分:2)
我刚刚安装了ICS更新。问题现在已经消失了!
答案 2 :(得分:0)
尝试在视图上发布runnable。
editText.post(new Runnable() {
@Override
public void run() {
InputMethodManager mgr = (InputMethodManager) getSystemService(
Context.INPUT_METHOD_SERVICE);
mgr.hideSoftInputFromWindow(editText.getWindowToken(), 0);
}
});