android软键盘上面的输入,Android 上的软键盘输入模式

本文详细介绍了如何在Android应用中通过XAML和C#设置软键盘输入模式,探讨了WindowSoftInputModeAdjust的两种模式:Pan和Resize,以及其在焦点变化时的影响。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Android 上的软键盘输入模式Soft Keyboard Input Mode on Android

07/10/2018

本文内容

This Android platform-specific is used to set the operating mode for a soft keyboard input area, and is consumed in XAML by setting the Application.WindowSoftInputModeAdjust attached property to a value of the WindowSoftInputModeAdjust enumeration:

xmlns:android="clr-namespace::::no-loc(Xamarin.Forms):::.PlatformConfiguration.AndroidSpecific;assembly=:::no-loc(Xamarin.Forms):::.Core"

android:Application.WindowSoftInputModeAdjust="Resize">

...

此外,还可以使用 Fluent API 从 c # 使用该方法:Alternatively, it can be consumed from C# using the fluent API:

using :::no-loc(Xamarin.Forms):::.PlatformConfiguration;

using :::no-loc(Xamarin.Forms):::.PlatformConfiguration.AndroidSpecific;

...

App.Current.On().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize);

Application.On方法指定此平台特定的仅在 Android 上运行。The Application.On method specifies that this platform-specific will only run on Android. [ Application.UseWindowSoftInputModeAdjust ] (x: :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration. UseWindowSoftInputModeAdjust (:::no-loc(Xamarin.Forms)::: 。IPlatformElementConfiguration { :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration :::no-loc(Xamarin.Forms)::: 。应用程序}, :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration. AndroidSpecific. WindowSoftInputModeAdjust) # A3 方法在 :::no-loc(Xamarin.Forms):::.PlatformConfiguration.AndroidSpecific 命名空间中,用于设置软键盘输入区域的运行模式, WindowSoftInputModeAdjust 枚举提供了两个值: Pan 和 Resize 。Pan该值使用 AdjustPan 调整选项,该选项不会在输入控件具有焦点时调整窗口的大小。The Pan value uses the AdjustPan adjustment option, which doesn't resize the window when an input control has focus. 相反,窗口的内容是平移的,因此不会由软键盘遮盖当前焦点。Instead, the contents of the window are panned so that the current focus isn't obscured by the soft keyboard. Resize该值使用 AdjustResize 调整选项,该选项可在输入控件有焦点的情况下调整窗口的大小,以便为软键盘腾出空间。The Resize value uses the AdjustResize adjustment option, which resizes the window when an input control has focus, to make room for the soft keyboard.

结果是,当输入控件具有焦点时,可以设置软键盘输入区域操作模式:The result is that the soft keyboard input area operating mode can be set when an input control has focus:

311cb8847a591e065971e5f446d2dca1.png311cb8847a591e065971e5f446d2dca1.png

相关链接Related links

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值