简体   繁体   English

如何使视图对齐键盘

[英]How to make the View Snap to Keyboard

My MasterDetail app won't The keyboard won't snap to the bottom of the view, it overlaps it.我的 MasterDetail 应用程序不会键盘不会捕捉到视图的底部,它与它重叠。 Main View is a contentpage Wrapped In (MasterDetail Page).主视图是一个内容页面(MasterDetail Page)。

I've placed some elements at the bottom of my main Contentpage via VerticalOptions="end" and they are at the bottom of the page when I scroll(scrollview with button inside grid (with highest z-index)), but they are covered when the keyboard is opened(from editor sibling to button inside grid).我已经通过 VerticalOptions="end" 在我的主 Contentpage 底部放置了一些元素,当我滚动时它们位于页面底部(滚动视图带有网格内的按钮(具有最高的 z-index)),但它们被覆盖当键盘打开时(从编辑器兄弟到网格内的按钮)。 I've tried setting this code:我试过设置这个代码:

<Activity Android: 
windowSoftInputMode="adjustResize">
</activity>

in AndroiManifest.xml but it doesn't work.在 AndroiManifest.xml 中,但它不起作用。

default page view, not my app but same structure默认页面视图,不是我的应用程序,而是相同的结构

Expected behavior预期行为

Actual behavior实际行为

If you are talking about keyboard covering your controls,如果您正在谈论覆盖控件的键盘,

For android:对于安卓:

Add in this your MainActivity after LoadApplication(new App());在 LoadApplication(new App()); 之后添加你的 MainActivity;

        App.Current.On<Xamarin.Forms.PlatformConfiguration.Android>().
        UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize);

For ios refer this link对于 ios,请参阅此链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM