zoukankan      html  css  js  c++  java
  • Xamarin.Forms android实现沉浸式

    在android项目里,这样设置

    using System;
    
    using Android.App;
    using Android.Content.PM;
    using Android.Runtime;
    using Android.Views;
    using Android.Widget;
    using Android.OS;
    
    namespace Doubi.Droid
    {
        [Activity(Label = "Doubi", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
        public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
        {
            protected override void OnCreate(Bundle bundle)
            {
                TabLayoutResource = Resource.Layout.Tabbar;
                ToolbarResource = Resource.Layout.Toolbar;
    
                var uiOpts = SystemUiFlags.LayoutStable | SystemUiFlags.LayoutFullscreen;
                //LayoutStable表示布局稳定,不随其他变动而变动
                //LayoutFullscreen表示把布局拓宽到全屏幕
    
                Window.DecorView.SystemUiVisibility = (StatusBarVisibility)uiOpts;
    
                //把标题栏设置为透明色
                Window.SetStatusBarColor(Android.Graphics.Color.Argb(0,0,0,0));
    
                base.OnCreate(bundle);
    
                Doubi.KLineView.Density = Resources.DisplayMetrics.Density;
    
                global::Xamarin.Forms.Forms.Init(this, bundle);
                LoadApplication(new App());
            }
        }
    }

    更多UIFlag的说明:

    Flag意义
    SYSTEM_UI_FLAG_LOW_PROFILE 弱化状态栏和导航栏的图标
    SYSTEM_UI_FLAG_HIDE_NAVIGATION 隐藏导航栏,用户点击屏幕会显示导航栏
    SYSTEM_UI_FLAG_FULLSCREEN 隐藏状态栏
    SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 拓展布局到导航栏后面
    SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 拓展布局到状态栏后面
    SYSTEM_UI_FLAG_LAYOUT_STABLE 稳定的布局,不会随系统栏的隐藏、显示而变化
    SYSTEM_UI_FLAG_IMMERSIVE 沉浸模式,用户可以交互的界面
    SYSTEM_UI_FLAG_IMMERSIVE_STICKY 沉浸模式,用户可以交互的界面。同时,用户上下拉系统栏时,会自动隐藏系统栏
     
  • 相关阅读:
    jQuery层级选择器
    jQuery基本选择器
    What is the difference between try/except and assert?
    glove 安装错误
    Windows10+anaconda,python3.5, 安装glove-python
    GloVe:另一种Word Embedding方法
    PyTorch在NLP任务中使用预训练词向量
    理解GloVe模型(Global vectors for word representation)
    word2vec 中的数学原理详解(二)预备知识
    Python zip() 函数
  • 原文地址:https://www.cnblogs.com/IWings/p/9462719.html
Copyright © 2011-2022 走看看