private void listenerSoftInput() {
  final View activityRootView = findViewById(R.id.activityRoot);
  activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(
        new OnGlobalLayoutListener() {
        @Override
          public void onGlobalLayout() {
            int heightDiff = activityRootView.getRootView()
                      .getHeight() - activityRootView.getHeight();
            if (heightDiff > 100) { // 如果高度差超过100像素,就很有可能是有软键盘...
            scrollToBottom();
        } else {
        }
}
});
}

//scrollview滑到底部

protected void scrollToBottom() {
handler.postDelayed(new Runnable() {
@Override
public void run() {
scrollview.fullScroll(View.FOCUS_DOWN);
}
}, 100);
}

更多相关文章

  1. Android(安卓)Studio点击空白处收起软键盘
  2. android中隐藏以及显示软键盘代码
  3. android 截获键盘事件
  4. Android(安卓)键盘弹出与隐藏
  5. Android仿iOS时间选择器
  6. Android(安卓)点击按钮隐藏键盘
  7. android 监听判断软键盘的弹出、隐藏状态
  8. android .9 图片的全能适配方法
  9. android软键盘的显示与隐藏

随机推荐

  1. Android(安卓)SDK 环境配置
  2. Android自定义View基础--Paint画笔设置样
  3. XE5 Android(安卓)开发数据访问server端
  4. 引擎设计跟踪(九.14.2i) Android(安卓)GL
  5. Android系统RTC调试从驱动到应用(一)
  6. android之lint警告This Handler class sh
  7. android 动画原理源码分析之Animation
  8. Eclipse下查看Android源代码
  9. Android(安卓)下拉刷新上拉加载
  10. Android(安卓)获取指向Resource的URI[转]