android 隐藏虚拟键回调的方法
2017-03-06 18:04
549 查看
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 > dpToPx(this, 200)) { // if more than 200 dp, it's probably a keyboard...
// ... do something here
}
}
});
activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
int heightDiff = activityRootView.getRootView().getHeight() - activityRootView.getHeight();
if (heightDiff > dpToPx(this, 200)) { // if more than 200 dp, it's probably a keyboard...
// ... do something here
}
}
});
相关文章推荐
- Android 4.4.2 横屏应用隐藏状态栏和底部虚拟键的方法
- Android沉浸式以及虚拟键冲突的解决方法和隐藏状态栏、标题栏的实现
- Android 隐藏底部虚拟键的两种方法
- <为知更新>windows下使用android隐藏api的方法
- android隐藏以及显示软键盘以及不自动弹出键盘的方法
- 使用Android隐藏类和隐藏方法
- android-实现仿系统search框的autoCompleteTextView----如何调用系统的隐藏方法
- android-实现仿系统search框的autoCompleteTextView----如何调用系统的隐藏方法
- Android事件侦听器回调方法浅谈
- Android 4.0 隐藏虚拟按键(导航栏)的方法
- Android 装载器---使用LoaderManager的回调方法
- windowsphone7 关于隐藏虚拟软键盘(SIP)的方法
- Android中隐藏状态栏和标题栏的方法
- Android 4.0 隐藏虚拟按键(导航栏)的方法 .
- Android 方法回调
- android通过线程回调java方法
- 使用Android隐藏类和隐藏方法
- 关于Android虚拟器无法联网的解决方法
- android 全屏、隐藏标题、横屏显示方法
- 一个隐藏android应用图标的方法