检测键盘android系统 [英] Detect keyboard in android

查看:164
本文介绍了检测键盘android系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有包含安装的应用程序列表,并发动他们click.In我的应用程序使用Intent.ACTION_CLOSE_SYSTEM_DIALOG广播用于关闭系统对话框,如任务管理器(近期应用程序对话框),电源选项对话框,低电池项目android应用对话框等等....但是这个隐藏键盘在一些devices.I想确保用户无法最近应用程序对话框,我applications.How我可以关闭除键盘系统对话框进行交互?我如何检查是否显示键盘还是不?是有可能发现最近的应用程序对话框?我被困在此的hours.Any帮助绝AP preciating。

I have an android application which contain list of installed applications and launch them on item click.In my application I used Intent.ACTION_CLOSE_SYSTEM_DIALOG broadcast for closing system dialogs such as Task Manager(Recent Apps dialog),Power Option dialog,Low battery dialog etc....But this hides keyboard in some devices.I want to make sure that the user could not interact with recent apps dialog from my applications.How can i close system dialogs except keyboard?How can i check whether the keyboard visible or not?Is it possible to detect Recent Apps dialog?I am stuck on this for hours.Any help must appreciating.

推荐答案

我用这个code检测键盘。

I've used this code to detect keyboard.

view.getViewTreeObserver().addOnGlobalLayoutListener(
                new OnGlobalLayoutListener() {

                    @Override
                    public void onGlobalLayout() {


                            int heightDiff = 

view.getRootView().getHeight()
                                    - view.getHeight();
                            if (heightDiff > 200) {
                                keyboardUp = true;

                                return;
                            }
                            if (keyboardUp) {
                                keyboardUp = false;

                            }
                            Log.e("Keyboard", "" + keyboardUp);
                        }
                    });

这篇关于检测键盘android系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆