在Windows Phone 8中打开键盘时如何调整屏幕? [英] How to adjust screen when keyboard open in windows phone 8?

查看:93
本文介绍了在Windows Phone 8中打开键盘时如何调整屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Windows Phone 8中工作.在我的应用程序的其中一个页面中,有一个LongListSelector,在它的下面是一个TextBox.当TextBox对准焦点时,将打开键盘.打开键盘后,LongListSelector会向上移动键盘高度.如果我通过键盘的偏移量保持LongListSelector的边距,那么LongListSelector的某些项目将进入键盘下方.

I am working in Windows phone 8. In One of the pages of my app there is a LongListSelector and under it there is a TextBox. When the TextBox get focused then keyboard is opened. As the keyboard is opened then the LongListSelector is shifted up by keyboard height. If I maintain the margin of the LongListSelector by keyboard's offset then some of the items of LongListSelector go under the keyboard.

我要做的就是显示键盘时,边距将被更新,并且LongListSelector的上一个重点项目不应放在键盘下.在这里,我不想使用ScrollTo()函数来滚动LongListSelector的特定项目.

All I want to do is when keyboard is shown then margin will be updated and the previous focused item of the LongListSelector should not go under keyboard. Here I don't want to use ScrollTo() function to scroll a specific item of LongListSelector.

任何建议或帮助将不胜感激.

Any suggestion or help will be appreciated.

推荐答案

这里是

Here is an example of workaround. Though this code is for WP8. You will have to make some changes to make this working for WP8.1 like :

  1. xaml中的点击将由"tapped"替换.
  2. ((App)Application.Current).RootFrame.RenderTransform = new CompositeTransform(); 将替换为

  1. Tap in xaml will be replaced by Tapped.
  2. ((App)Application.Current).RootFrame.RenderTransform = new CompositeTransform(); will be replaced by

Window.Current.Content.RenderTransform = new CompositeTransform();

Window.Current.Content.RenderTransform = new CompositeTransform();

Dispatcher.BeginInvoke(() => {}将替换为

CoreDispatcher dispatcher = CoreWindow.GetForCurrentThread().Dispatcher; await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {}

CoreDispatcher dispatcher = CoreWindow.GetForCurrentThread().Dispatcher; await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {}

让我知道您是否遇到任何问题.

let me know if you face any issue.

这篇关于在Windows Phone 8中打开键盘时如何调整屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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