安卓SoftKeyboardDetect:忽略此事件意味着什么呢? [英] Android SoftKeyboardDetect: Ignore this event what does it mean?

查看:393
本文介绍了安卓SoftKeyboardDetect:忽略此事件意味着什么呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常看到在LogCat中此调试信息。当执行滑动或旋转设备例如。该仿真器不响应事件即可。这是什么意思?

I see this debug message frequently in LogCat. When doing swipe or rotating the device for example. The emulator doesn't react to the events then. What does it mean?

在需要在模拟器上,但在某些版本中,当我preSS CTRL F12或Ctrl F11没有任何反应(当然,该装置旋转作为一个整体而不是屏幕),我看到日志此消息测试旋转。我不觉得有什么谷歌要么...

In need to test rotation on the emulator but on some versions, when I press CTRL F12 or CTRL F11 nothing happens (well, the device rotates as a whole but not the screen) and I see this message in log. I don't find anything with google either...

好吧,这是PhoneGap的具体。我发现了一些在PhoneGap的来源$ C ​​$ C:

Ok, it's PhoneGap specific. I found something in the source code of PhoneGap:

 /**
  * We are providing this class to detect when the soft keyboard is shown 
  * and hidden in the web view.
  */
 class LinearLayoutSoftKeyboardDetect extends LinearLayout {

        private static final String TAG = "SoftKeyboardDetect";

但我没有做任何事情与软键盘,我只是旋转设备。这是一个错误,也许?

But I'm not doing anything with soft keyboard, I'm just rotating the device. It's a bug maybe?

推荐答案

我可以给你这个日志的背景。有一个在Android的一个bug或者他们会打电话它缺乏的功能,但没有事件引发的键盘显示或消失时。这将导致Web应用程序的问题,因为键盘缩短了屏幕尺寸。当屏幕尺寸变小,然后你的用户界面受到影响。

I can give you the background on this log. There is a bug in Android or maybe they'd call it a lack of feature but there is no event thrown when the keyboard is shown or goes away. This causes a problem for web applications as the keyboard shortens the the screen size. When the screen size becomes smaller then your UI suffers.

在为了能够作出反应的键盘显示/隐藏在PhoneGap的机器人我们实现这基本上是一个的LinearLayout的LinearLayoutSoftKeyboardDetect但是它的反应的变化,屏幕尺寸。如果旋转装置的宽度变得高度,我们可以忽略的变化,但如果高度变得急剧小而宽度保持不变它是安全的假设有被示出的键盘和我们抛出一个节目键盘事件。当高度急剧变大,而宽度保持不变,我们抛出一个隐藏键盘事件。有意义吗?

In order to be able to react to the keyboard show/hide in PhoneGap Android we implemented the LinearLayoutSoftKeyboardDetect which is basically a LinearLayout but it reacts to changes in the screen size. If you rotate the device the width becomes the height and we can ignore the change but if the height gets dramatically smaller while the width remains the same it is safe to assume there is a keyboard being shown and we throw a show keyboard event. When the height gets dramatically larger while width stays the same we throw a hide keyboard event. Make sense?

这篇关于安卓SoftKeyboardDetect:忽略此事件意味着什么呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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