检测屏幕键盘是否已在 Windows Phone 7 上显示 [英] Detect that the onscreen keyboard has been displayed on Windows Phone 7

查看:26
本文介绍了检测屏幕键盘是否已在 Windows Phone 7 上显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简单的问题:如何检测屏幕键盘已显示在 windows mobile 7 上?是否有我可以添加侦听器的事件?

Simple question: How do I detect that the onscreen keyboard has been displayed on windows mobile 7? Is there an event I can add a listener to?

它占据了大约一半的屏幕,我想在显示时向上滚动视图...

It takes up about half the screen and I want to scroll the view up when it gets displayed...

下面的评论更清楚地表明了我要做什么:我有一个文本框输入,当用户输入时,它下面会出现一个自动完成下拉列表(如谷歌建议).默认情况下,活动控件(文本框)在聚焦时滚动到视图中,屏幕键盘直接位于其下方.屏幕键盘出现在我的自动完成下拉菜单前面 - 我想要做的是让屏幕向上滚动一点,这样我的下拉菜单就有一些空间可以显示.

A comment below indicates more clearly what I'm trying to do: I have a textbox input, and as the user types into it an autocomplete dropdown appears below it (like google suggest). By default, the active control (the textbox) scrolls into view when focussed, and the onscreen keyboard is directly below it. The onscreen keyboard appears in front of my autocomplete dropdown - what I want to do is make the screen scroll a little further up, so there's some room for my dropdown to be shown.

windows phone UI 设计指南说:部署键盘时,应用程序应滚动以确保活动编辑控件和插入符号在视图中".这发生得很好,只是非活动下拉菜单隐藏在屏幕键盘后面.

The windows phone UI design guidelines say: "When the keyboard is deployed, the application should scroll to ensure the active edit control and the caret are in view". This happens fine, it's just the non-active dropdown gets hidden behind the onscreen keyboard.

指南还说应用程序可以选择显示屏幕键盘,也可以选择关闭它.

The guidelines also say that an application can choose to show the onscreen keyboard, and can also choose to close it.

目前我被卡住了,我不认为(根据我的研究和对这个问题的回复)有可能检测到屏幕键盘已被显示.我正在移动我的调查,看看是否可以确定页面的可见区域"(例如宽度和高度,以像素为单位),并将其与文本框的焦点结合起来......不确定这是否会证明虽然很有成效.

At the moment i'm stuck, and I don't think (based on my research and the replies to this question) that it's possible to detect that the onscreen keyboard has been displayed. I'm moving my investigation to see if it's possible to determine the "visible area" of the page (width & height in pixels for example), and combine this with an onfocus for the textbox... not sure if this will prove fruitful though.

推荐答案

在 7.0 中无法检测虚拟键盘何时显示,微软的 Peter Torr 在 MSDN 上的 WP7 论坛中证实了这一点.

Detecting when the virtual keyboard is displayed won't be possible in 7.0, as confirmed by Microsoft's Peter Torr in the WP7 forum on MSDN.

也许,作为一个肮脏的解决方法,您可以检测文本框的位置(或其父滚动查看器的偏移量)何时发生变化,因为这表明虚拟键盘已经出现或消失.

Maybe, as a dirty workaround, you could detect when the position of your text box (or its parent scroll viewer's offset) has changed, as this would indicate that the virtual keyboard has appeared or disappeared.

这篇关于检测屏幕键盘是否已在 Windows Phone 7 上显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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