这是我对 xaml 的定义:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Entry Placeholder="Write text..."/>
<Button Text="Button" Grid.Row="1" VerticalOptions="End" />
</Grid>
当我单击控件输入时,键盘可见。我的界面已卷起:
我可以通过从 RowDecinition Height 中删除所有星星来修复此问题,但严格设置该值会导致它无法适应所有屏幕。
键盘可见时是否可以关闭卷起界面?
最佳答案
在 MainActivity.cs 中:
protected override void OnCreate(Bundle savedInstanceState)
{
...
App.Current.On<Microsoft.Maui.Controls.PlatformConfiguration.Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Pan);
...
}
关于c# - 键盘出现时 UI 卷起 - MAUI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75359287/