锁定列表视图滚动事件

时间:2013-10-21 16:25:42

标签: java android android-listview

如何在键盘弹出时冻结列表视图滚动,然后在隐藏键盘后重新获得滚动。 我似乎无法从任何地方开始

1 个答案:

答案 0 :(得分:0)

在On ScrollState中,更改检查键盘是否打开:

   public void onScrollStateChanged(AbsListView view, int scrollState) {   
  //check keyboard is open?    
 InputMethodManager imm = (InputMethodManager) getActivity()
        .getSystemService(Context.INPUT_METHOD_SERVICE);

if (imm.isAcceptingText()) {
    writeToLog("Software Keyboard was shown");
} else {
    writeToLog("Software Keyboard was not shown");
}
}

并使用

停止列表视图
   listView.setScrollContainer(false);
相关问题