篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp Xamarin Android - Oculta o toolbar nativo相关的知识,希望对你有一定的参考价值。
// https://forums.xamarin.com/discussion/83688/cannot-truely-hide-the-status-bar-on-android
// Oculta o toolbar nativo do Android
if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
{
// Kill status bar underlay added by FormsAppCompatActivity
// Must be done before calling FormsAppCompatActivity.OnCreate()
var statusBarHeightInfo = typeof(FormsAppCompatActivity).GetField("statusBarHeight", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
if (statusBarHeightInfo == null)
{
statusBarHeightInfo = typeof(FormsAppCompatActivity).GetField("_statusBarHeight", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
}
statusBarHeightInfo?.SetValue(this, 0);
}
以上是关于csharp Xamarin Android - Oculta o toolbar nativo的主要内容,如果未能解决你的问题,请参考以下文章