当键盘在xamarin forms android中弹出并且EditText字段位于屏幕底部时,状态栏和屏幕完全向上移动。我尝试使用
WindowSoftInputMode = SoftInput.AdjustPan
和
WindowSoftInputMode = SoftInput.AdjustResize
但不幸的是,两者都不起作用,我也从我读过的一篇博客文章中加入了
Xamarin.Forms.Application.Current.On<Xamarin.Forms.PlatformConfiguration.Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize);
和
if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
{
Window.DecorView.SystemUiVisibility = 0;
var statusBarHeightInfo = typeof(FormsAppCompatActivity).GetField("_statusBarHeight", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
statusBarHeightInfo.SetValue(this, 0);
Window.SetStatusBarColor(new Android.Graphics.Color(0,0,0, 255)); // Change color as required.
}
启动应用程序后是另一种选择,但不幸的是这也失败了。还有其他选择吗?