-
-
Save amay077/b1164b21af276832b666c2b7825bdab8 to your computer and use it in GitHub Desktop.
AdjustResize Workaround for Xamarin.Forms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void OnCreate(Bundle bundle) | |
{ | |
ToolbarResource = Resource.Layout.toolbar; | |
TabLayoutResource = Resource.Layout.tabs; | |
base.OnCreate(bundle); | |
Window.SetSoftInputMode(SoftInput.AdjustResize); | |
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(18, 52, 86, 255)); | |
} | |
global::Xamarin.Forms.Forms.Init(this, bundle); | |
LoadApplication(new App()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void OnCreate(Bundle bundle) | |
{ | |
ToolbarResource = Resource.Layout.toolbar; | |
TabLayoutResource = Resource.Layout.tabs; | |
base.OnCreate(bundle); | |
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(18, 52, 86, 255)); | |
} | |
global::Xamarin.Forms.Forms.Init(this, bundle); | |
LoadApplication(new App()); | |
App.Current.On<Xamarin.Forms.PlatformConfiguration.Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Working, but its flickering. any updates ?