索尼平板电脑键盘弹出问题

时间:2012-05-23 14:09:30

标签: scrollview android-activity android sony

是否有其他人知道如何解决Sony Tablet S上非常恼人的问题。

我有一个垂直的ScrollView和一个包含大量TextView和一些EditTexts的线性布局。当我向下滚动屏幕并进入EditText时,设备决定给出EditText焦点并弹出键盘。

在其他设备上不会发生这种情况,例如华硕Transformer Prime,HTC One X,三星Galaxy Tab和HP TouchPad(cyanogenmod)。

我做过的事情。

  • Windows Soft Input模式在活动清单中设置为“stateHidden”。
  • 堆栈顶部有一个LinearLayout,可以将焦点和焦点设置为true。
  • 代码也会将此布局重点放在create上。

这绝对是索尼平板电脑特有的问题!

其他人有这个问题和解决方案吗?

由于

3 个答案:

答案 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);
   }
});