在 WP7 中显示软键盘时防止屏幕向上滚动? [英] Prevent screen scrolling up when soft keyboard is shown in WP7?

查看:23
本文介绍了在 WP7 中显示软键盘时防止屏幕向上滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当软键盘显示在 Windows Phone 应用程序中时,有没有办法防止屏幕向上移动?

Is there a way to prevent the screen to shift upwards when the soft keyboard is shown in a Windows Phone app?

我有一个位于屏幕上半部分的文本框,所以当显示软键盘时,它不会覆盖文本框.然而,当文本框被点击时,屏幕仍然向上移动.

I have a text box which is located in the upper half of the screen, so when the soft keyboard is shown, it doesn't cover the text box. However, when the textbox is tapped, the screen still shifts up.

这能被阻止吗?

推荐答案

我花了很多时间试图找到解决方案 - 在我的情况下,我希望页眉保留在屏幕顶部而不是滚动离开当键盘打开时.

I spent quite some time trying to find a solution to this - in my case I wanted the page header to remain at the top of the screen instead of scrolling away when the keyboard opened.

我找到的最好的解决方案是下面帖子中描述的解决方案,它使用框架 TranslateTransform(由键盘打开/关闭触发)中的更改来更改上边距的大小,从而更改可用内容的空间.

The best I found was the solution described in the post below, which uses changes in the frame's TranslateTransform (which is triggered by the keyboard opening / closing) to change the size of the top margin and therefore the space for available content.

http://sorokoletov.com/2011/08/windows-phone-70-handling-text-entry-screens/

如果您有一个包含多个元素的屏幕,您可能需要考虑明确更改布局以适应较小的空间.

If you have a screen with a number of elements, you may want to consider explicitly changing the layout to accommodate the smaller space.

这篇关于在 WP7 中显示软键盘时防止屏幕向上滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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