SystemUI默认去掉底部导航栏

一、背景

           在Android系统中,SystemUI负责管理系统的状态栏、导航栏等用户界面元素。若要在SystemUI中默认去掉底部导航栏,可以通过以下几种方法实现:

        1. 修改布局文件     

在Android的SystemUI源代码中,底部导航栏的布局文件通常位于com.android.systemui.statusbar.phone包中,文件名可能为NavigationBarView.xml或其他与导航栏相关的布局文件。通过修改这些布局文件,可以隐藏底部导航栏。具体步骤包括:

  • 使用Android Studio或其他IDE打开SystemUI项目。
  • 导入Android的SystemUI源代码。
  • 导航到与导航栏布局相关的文件。
  • 修改布局文件中的代码以隐藏底部导航栏,例如通过设置visibility属性为GONEINVISIBLE
frameworks\base\core\res\res\values\demins.xml

        2. 编程方式隐藏  

在SystemUI的Java代码中,可以通过编程方式控制底部导航栏的显示与隐藏。这通常涉及到对NavigationBarController或类似控制器的操作。例如,可以通过调用setSystemUiVisibility方法并传入适当的标志来隐藏导航栏,如View.SYSTEM_UI_FLAG_HIDE_NAVIGATION。但请注意,这种方法可能需要在应用层面而非系统层面实现,因为直接修改SystemUI的代码通常需要对Android系统进行深度定制。

frameworks\base\services\core\java\com\android\server\wm\DisplayPolicy.java

        3. 使用手势导航

主要核心代码:
framework/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java

二、改变状态栏或者其他系统UI的可见性


        setSystemUiVisibility(int visibility):通过setSystemUiVisibility(int visibility)方法,可以改变状态栏或者其他系统UI的可见性。getWindow().getDecorView().setSystemUiVisibility(int visibility);

可供选择的参数:

View.SYSTEM_UI_FLAG_VISIBLE(默认模式,显示状态栏和导航栏)
View.SYSTEM_UI_FLAG_LOW_PROFILE(低调模式,隐藏不重要的状态栏图标,导航栏中相应的图标都变成了一个小点。点击状态栏或导航栏还原成正常的状态)
SYSTEM_UI_FLAG_HIDE_NAVIGATION(隐藏导航栏,点击屏幕任意区域,导航栏将重新出现,并且不会自动消失
SYSTEM_UI_FLAG_FULLSCREEN(隐藏状态栏,点击屏幕区域不会出现,需要从状态栏位置下拉才会出现)
SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
 

 

三、三种方法去去掉底部导航栏

1、StatusBar中实现默认去掉底部导航栏

@Overridepublic void start() {mGroupManager = Dependency.get(NotificationGroupManager.class);mGroupAlertTransferHelper = Dependency.get(NotificationGroupAlertTransferHelper.class);mVisualStabilityManager = Dependency.get(VisualStabilityManager.class);mNotificationLogger = Dependency.get(NotificationLogger.class);mRemoteInputManager = Dependency.get(NotificationRemoteInputManager.class);mNotificationListener =  Dependency.get(NotificationListener.class);mNotificationListener.registerAsSystemService();mNetworkController = Dependency.get(NetworkController.class);mUserSwitcherController = Dependency.get(UserSwitcherController.class);mScreenLifecycle = Dependency.get(ScreenLifecycle.class);mScreenLifecycle.addObserver(mScreenObserver);mWakefulnessLifecycle = Dependency.get(WakefulnessLifecycle.class);mWakefulnessLifecycle.addObserver(mWakefulnessObserver);mBatteryController = Dependency.get(BatteryController.class);mDataSaverController = Dependency.get(DataSaverController.class);mAssistManager = Dependency.get(AssistManager.class);mUiModeManager = mContext.getSystemService(UiModeManager.class);mLockscreenUserManager = Dependency.get(NotificationLockscreenUserManager.class);mGutsManager = Dependency.get(NotificationGutsManager.class);mMediaManager = Dependency.get(NotificationMediaManager.class);mEntryManager = Dependency.get(NotificationEntryManager.class);mNotificationInterruptionStateProvider =Dependency.get(NotificationInterruptionStateProvider.class);mViewHierarchyManager = Dependency.get(NotificationViewHierarchyManager.class);mForegroundServiceController = Dependency.get(ForegroundServiceController.class);mAppOpsController = Dependency.get(AppOpsController.class);mZenController = Dependency.get(ZenModeController.class);mKeyguardViewMediator = getComponent(KeyguardViewMediator.class);mColorExtractor = Dependency.get(SysuiColorExtractor.class);mDeviceProvisionedController = Dependency.get(DeviceProvisionedController.class);mNavigationBarController = Dependency.get(NavigationBarController.class);mBubbleController = Dependency.get(BubbleController.class);mBubbleController.setExpandListener(mBubbleExpandListener);mActivityIntentHelper = new ActivityIntentHelper(mContext);KeyguardSliceProvider sliceProvider = KeyguardSliceProvider.getAttachedInstance();if (sliceProvider != null) {sliceProvider.initDependencies(mMediaManager, mStatusBarStateController);} else {Log.w(TAG, "Cannot init KeyguardSliceProvider dependencies");}mColorExtractor.addOnColorsChangedListener(this);mStatusBarStateController.addCallback(this,SysuiStatusBarStateController.RANK_STATUS_BAR);mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);mDreamManager = IDreamManager.Stub.asInterface(ServiceManager.checkService(DreamService.DREAM_SERVICE));/* UNISOC: Bug 1074234, 885650, Super power feature @{ */if(SprdPowerManagerUtil.SUPPORT_SUPER_POWER_SAVE){int mode = SprdPowerManagerUtil.getPowerSaveModeInternal();mPowerSaveMode = mode;curMode = mode;}/* @} */mDisplay = mWindowManager.getDefaultDisplay();mDisplayId = mDisplay.getDisplayId();updateDisplaySize();mVibrateOnOpening = mContext.getResources().getBoolean(R.bool.config_vibrateOnIconAnimation);mVibratorHelper = Dependency.get(VibratorHelper.class);DateTimeView.setReceiverHandler(Dependency.get(Dependency.TIME_TICK_HANDLER));putComponent(StatusBar.class, this);// start old BaseStatusBar.start().mWindowManagerService = WindowManagerGlobal.getWindowManagerService();mDevicePolicyManager = (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);mAccessibilityManager = (AccessibilityManager)mContext.getSystemService(Context.ACCESSIBILITY_SERVICE);mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);mKeyguardUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext);mBarService = IStatusBarService.Stub.asInterface(ServiceManager.getService(Context.STATUS_BAR_SERVICE));mRecents = getComponent(Recents.class);mKeyguardManager = (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE);// Connect in to the status bar manager servicemCommandQueue = getComponent(CommandQueue.class);mCommandQueue.addCallback(this);RegisterStatusBarResult result = null;try {result = mBarService.registerStatusBar(mCommandQueue);} catch (RemoteException ex) {ex.rethrowFromSystemServer();}createAndAddWindows(result);// Make sure we always have the most current wallpaper info.IntentFilter wallpaperChangedFilter = new IntentFilter(Intent.ACTION_WALLPAPER_CHANGED);mContext.registerReceiverAsUser(mWallpaperChangedReceiver, UserHandle.ALL,wallpaperChangedFilter, null /* broadcastPermission */, null /* scheduler */);mWallpaperChangedReceiver.onReceive(mContext, null);// Set up the initial notification state. This needs to happen before CommandQueue.disable()setUpPresenter();setSystemUiVisibility(mDisplayId, result.mSystemUiVisibility,result.mFullscreenStackSysUiVisibility, result.mDockedStackSysUiVisibility,0xffffffff, result.mFullscreenStackBounds, result.mDockedStackBounds,result.mNavbarColorManagedByIme);// StatusBarManagerService has a back up of IME token and it's restored here.setImeWindowStatus(mDisplayId, result.mImeToken, result.mImeWindowVis,result.mImeBackDisposition, result.mShowImeSwitcher);// Set up the initial icon stateint numIcons = result.mIcons.size();for (int i = 0; i < numIcons; i++) {mCommandQueue.setIcon(result.mIcons.keyAt(i), result.mIcons.valueAt(i));}if (DEBUG) {Log.d(TAG, String.format("init: icons=%d disabled=0x%08x lights=0x%08x imeButton=0x%08x",numIcons,result.mDisabledFlags1,result.mSystemUiVisibility,result.mImeWindowVis));}IntentFilter internalFilter = new IntentFilter();internalFilter.addAction(BANNER_ACTION_CANCEL);internalFilter.addAction(BANNER_ACTION_SETUP);mContext.registerReceiver(mBannerActionBroadcastReceiver, internalFilter, PERMISSION_SELF,null);IWallpaperManager wallpaperManager = IWallpaperManager.Stub.asInterface(ServiceManager.getService(Context.WALLPAPER_SERVICE));try {wallpaperManager.setInAmbientMode(false /* ambientMode */, 0L /* duration */);} catch (RemoteException e) {// Just pass, nothing critical.}// end old BaseStatusBar.start().// Lastly, call to the icon policy to install/update all the icons.mIconPolicy = new PhoneStatusBarPolicy(mContext, mIconController);mSignalPolicy = new StatusBarSignalPolicy(mContext, mIconController);mUnlockMethodCache = UnlockMethodCache.getInstance(mContext);mUnlockMethodCache.addListener(this);startKeyguard();mKeyguardUpdateMonitor.registerCallback(mUpdateCallback);putComponent(DozeHost.class, mDozeServiceHost);mScreenPinningRequest = new ScreenPinningRequest(mContext);mFalsingManager = FalsingManagerFactory.getInstance(mContext);Dependency.get(ActivityStarterDelegate.class).setActivityStarterImpl(this);Dependency.get(ConfigurationController.class).addCallback(this);// set the initial view visibilityDependency.get(InitController.class).addPostInitTask(this::updateAreThereNotifications);int disabledFlags1 = result.mDisabledFlags1;int disabledFlags2 = result.mDisabledFlags2;Dependency.get(InitController.class).addPostInitTask(() -> setUpDisableFlags(disabledFlags1, disabledFlags2));// UNISOC: BUG 1156257 add screen resolution observer to control NavigationBarViewmContext.getContentResolver().registerContentObserver(Settings.System.getUriFor(ACTION_SR_CHANGING),false, mScreenResolutionObserver);CommonUtils.setRegionOrLongshotMode(mContext.getContentResolver(), 0);}// ================================================================================// Constructing the view// ================================================================================protected void makeStatusBarView(@Nullable RegisterStatusBarResult result) {final Context context = mContext;updateDisplaySize(); // populates mDisplayMetricsupdateResources();updateTheme();inflateStatusBarWindow(context);mStatusBarWindow.setService(this);mStatusBarWindow.setOnTouchListener(getStatusBarWindowTouchListener());// TODO: Deal with the ugliness that comes from having some of the statusbar broken out// into fragments, but the rest here, it leaves some awkward lifecycle and whatnot.mNotificationPanel = mStatusBarWindow.findViewById(R.id.notification_panel);mStackScroller = mStatusBarWindow.findViewById(R.id.notification_stack_scroller);mZenController.addCallback(this);NotificationListContainer notifListContainer = (NotificationListContainer) mStackScroller;mNotificationLogger.setUpWithContainer(notifListContainer);mNotificationIconAreaController = SystemUIFactory.getInstance().createNotificationIconAreaController(context, this, mStatusBarStateController);inflateShelf();mNotificationIconAreaController.setupShelf(mNotificationShelf);Dependency.get(DarkIconDispatcher.class).addDarkReceiver(mNotificationIconAreaController);// Allow plugins to reference DarkIconDispatcher and StatusBarStateControllerDependency.get(PluginDependencyProvider.class).allowPluginDependency(DarkIconDispatcher.class);Dependency.get(PluginDependencyProvider.class).allowPluginDependency(StatusBarStateController.class);FragmentHostManager.get(mStatusBarWindow).addTagListener(CollapsedStatusBarFragment.TAG, (tag, fragment) -> {CollapsedStatusBarFragment statusBarFragment =(CollapsedStatusBarFragment) fragment;statusBarFragment.initNotificationIconArea(mNotificationIconAreaController);PhoneStatusBarView oldStatusBarView = mStatusBarView;mStatusBarView = (PhoneStatusBarView) fragment.getView();mStatusBarView.setBar(this);mStatusBarView.setPanel(mNotificationPanel);mStatusBarView.setScrimController(mScrimController);// CollapsedStatusBarFragment re-inflated PhoneStatusBarView and both of// mStatusBarView.mExpanded and mStatusBarView.mBouncerShowing are false.// PhoneStatusBarView's new instance will set to be gone in// PanelBar.updateVisibility after calling mStatusBarView.setBouncerShowing// that will trigger PanelBar.updateVisibility. If there is a heads up showing,// it needs to notify PhoneStatusBarView's new instance to update the correct// status by calling mNotificationPanel.notifyBarPanelExpansionChanged().if (mHeadsUpManager.hasPinnedHeadsUp()) {mNotificationPanel.notifyBarPanelExpansionChanged();}mStatusBarView.setBouncerShowing(mBouncerShowing);if (oldStatusBarView != null) {float fraction = oldStatusBarView.getExpansionFraction();boolean expanded = oldStatusBarView.isExpanded();mStatusBarView.panelExpansionChanged(fraction, expanded);}HeadsUpAppearanceController oldController = mHeadsUpAppearanceController;if (mHeadsUpAppearanceController != null) {// This view is being recreated, let's destroy the old onemHeadsUpAppearanceController.destroy();}mHeadsUpAppearanceController = new HeadsUpAppearanceController(mNotificationIconAreaController, mHeadsUpManager, mStatusBarWindow);mHeadsUpAppearanceController.readFrom(oldController);mStatusBarWindow.setStatusBarView(mStatusBarView);updateAreThereNotifications();checkBarModes();}).getFragmentManager().beginTransaction().replace(R.id.status_bar_container, new CollapsedStatusBarFragment(),CollapsedStatusBarFragment.TAG).commit();mIconController = Dependency.get(StatusBarIconController.class);mHeadsUpManager = new HeadsUpManagerPhone(context, mStatusBarWindow, mGroupManager, this,mVisualStabilityManager);Dependency.get(ConfigurationController.class).addCallback(mHeadsUpManager);mHeadsUpManager.addListener(this);mHeadsUpManager.addListener(mNotificationPanel);mHeadsUpManager.addListener(mGroupManager);mHeadsUpManager.addListener(mGroupAlertTransferHelper);mHeadsUpManager.addListener(mVisualStabilityManager);mAmbientPulseManager.addListener(this);mAmbientPulseManager.addListener(mGroupManager);mAmbientPulseManager.addListener(mGroupAlertTransferHelper);mNotificationPanel.setHeadsUpManager(mHeadsUpManager);mGroupManager.setHeadsUpManager(mHeadsUpManager);mGroupAlertTransferHelper.setHeadsUpManager(mHeadsUpManager);mNotificationLogger.setHeadsUpManager(mHeadsUpManager);putComponent(HeadsUpManager.class, mHeadsUpManager);createNavigationBar(result);if (ENABLE_LOCKSCREEN_WALLPAPER) {mLockscreenWallpaper = new LockscreenWallpaper(mContext, this, mHandler);}mKeyguardIndicationController =SystemUIFactory.getInstance().createKeyguardIndicationController(mContext,mStatusBarWindow.findViewById(R.id.keyguard_indication_area),mStatusBarWindow.findViewById(R.id.lock_icon));mNotificationPanel.setKeyguardIndicationController(mKeyguardIndicationController);mAmbientIndicationContainer = mStatusBarWindow.findViewById(R.id.ambient_indication_container);// TODO: Find better place for this callback.mBatteryController.addCallback(new BatteryStateChangeCallback() {@Overridepublic void onPowerSaveChanged(boolean isPowerSave) {mHandler.post(mCheckBarModes);if (mDozeServiceHost != null) {mDozeServiceHost.firePowerSaveChanged(isPowerSave);}}@Overridepublic void onBatteryLevelChanged(int level, boolean pluggedIn, boolean charging) {// noop}});mAutoHideController = Dependency.get(AutoHideController.class);mAutoHideController.setStatusBar(this);mLightBarController = Dependency.get(LightBarController.class);ScrimView scrimBehind = mStatusBarWindow.findViewById(R.id.scrim_behind);ScrimView scrimInFront = mStatusBarWindow.findViewById(R.id.scrim_in_front);mScrimController = SystemUIFactory.getInstance().createScrimController(scrimBehind, scrimInFront, mLockscreenWallpaper,(state, alpha, color) -> mLightBarController.setScrimState(state, alpha, color),scrimsVisible -> {if (mStatusBarWindowController != null) {mStatusBarWindowController.setScrimsVisibility(scrimsVisible);}if (mStatusBarWindow != null) {mStatusBarWindow.onScrimVisibilityChanged(scrimsVisible);}}, DozeParameters.getInstance(mContext),mContext.getSystemService(AlarmManager.class));mNotificationPanel.initDependencies(this, mGroupManager, mNotificationShelf,mHeadsUpManager, mNotificationIconAreaController, mScrimController);mDozeScrimController = new DozeScrimController(DozeParameters.getInstance(context));BackDropView backdrop = mStatusBarWindow.findViewById(R.id.backdrop);mMediaManager.setup(backdrop, backdrop.findViewById(R.id.backdrop_front),backdrop.findViewById(R.id.backdrop_back), mScrimController, mLockscreenWallpaper);// Other iconsmVolumeComponent = getComponent(VolumeComponent.class);mNotificationPanel.setUserSetupComplete(mUserSetup);if (UserManager.get(mContext).isUserSwitcherEnabled()) {createUserSwitcher();}mNotificationPanel.setLaunchAffordanceListener(mStatusBarWindow::onShowingLaunchAffordanceChanged);// Set up the quick settings tile panelView container = mStatusBarWindow.findViewById(R.id.qs_frame);if (container != null) {FragmentHostManager fragmentHostManager = FragmentHostManager.get(container);ExtensionFragmentListener.attachExtensonToFragment(container, QS.TAG, R.id.qs_frame,Dependency.get(ExtensionController.class).newExtension(QS.class).withPlugin(QS.class).withDefault(this::createDefaultQSFragment).build());mBrightnessMirrorController = new BrightnessMirrorController(mStatusBarWindow,(visible) -> {mBrightnessMirrorVisible = visible;updateScrimController();});fragmentHostManager.addTagListener(QS.TAG, (tag, f) -> {QS qs = (QS) f;if (qs instanceof QSFragment) {mQSPanel = ((QSFragment) qs).getQsPanel();mQSPanel.setBrightnessMirror(mBrightnessMirrorController);mFooter = ((QSFragment) qs).getFooter();}});}mReportRejectedTouch = mStatusBarWindow.findViewById(R.id.report_rejected_touch);if (mReportRejectedTouch != null) {updateReportRejectedTouchVisibility();mReportRejectedTouch.setOnClickListener(v -> {Uri session = mFalsingManager.reportRejectedTouch();if (session == null) { return; }StringWriter message = new StringWriter();message.write("Build info: ");message.write(SystemProperties.get("ro.build.description"));message.write("\nSerial number: ");message.write(SystemProperties.get("ro.serialno"));message.write("\n");PrintWriter falsingPw = new PrintWriter(message);FalsingLog.dump(falsingPw);falsingPw.flush();startActivityDismissingKeyguard(Intent.createChooser(new Intent(Intent.ACTION_SEND).setType("*/*").putExtra(Intent.EXTRA_SUBJECT, "Rejected touch report").putExtra(Intent.EXTRA_STREAM, session).putExtra(Intent.EXTRA_TEXT, message.toString()),"Share rejected touch report").addFlags(Intent.FLAG_ACTIVITY_NEW_TASK),true /* onlyProvisioned */, true /* dismissShade */);});}PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);if (!pm.isScreenOn()) {mBroadcastReceiver.onReceive(mContext, new Intent(Intent.ACTION_SCREEN_OFF));}mGestureWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK,"GestureWakeLock");mVibrator = mContext.getSystemService(Vibrator.class);int[] pattern = mContext.getResources().getIntArray(R.array.config_cameraLaunchGestureVibePattern);mCameraLaunchGestureVibePattern = new long[pattern.length];for (int i = 0; i < pattern.length; i++) {mCameraLaunchGestureVibePattern[i] = pattern[i];}// receive broadcastsIntentFilter filter = new IntentFilter();filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);filter.addAction(Intent.ACTION_SCREEN_OFF);filter.addAction(DevicePolicyManager.ACTION_SHOW_DEVICE_MONITORING_DIALOG);/* UNISOC: Bug 1074234, 885650, Super power feature @{ */if(SprdPowerManagerUtil.SUPPORT_SUPER_POWER_SAVE){filter.addAction(SprdPowerManagerUtil.ACTION_POWEREX_SAVE_MODE_CHANGED);}/* @} */context.registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL, filter, null, null);IntentFilter demoFilter = new IntentFilter();if (DEBUG_MEDIA_FAKE_ARTWORK) {demoFilter.addAction(ACTION_FAKE_ARTWORK);}demoFilter.addAction(ACTION_DEMO);context.registerReceiverAsUser(mDemoReceiver, UserHandle.ALL, demoFilter,android.Manifest.permission.DUMP, null);// listen for USER_SETUP_COMPLETE setting (per-user)mDeviceProvisionedController.addCallback(mUserSetupObserver);mUserSetupObserver.onUserSetupChanged();// disable profiling bars, since they overlap and clutter the output on app windowsThreadedRenderer.overrideProperty("disableProfileBars", "true");// Private API call to make the shadows look better for RecentsThreadedRenderer.overrideProperty("ambientRatio", String.valueOf(1.5f));/* UNISOC: Bug 1074234, 885650, Super power feature @{ */if(SprdPowerManagerUtil.SUPPORT_SUPER_POWER_SAVE && mNotificationPanel != null){int mode = SprdPowerManagerUtil.getPowerSaveModeInternal();if(mFooter != null){mFooter.setPowerSaveMode(mode);}if(mQSPanel != null){mQSPanel.setPowerSaveMode(mode);}if (mNotificationPanel != null){mNotificationPanel.setPowerSaveMode(mode);}/* UNISOC: Modify for bug974161 {@ */mNavigationBarController.setPowerSaveMode(mode);/* @} */}/* @} *//* UNISOC: Bug 1104465 add for screen pinning @{ */mScreenPinningNotify = new ScreenPinningNotify(mContext);/* @} */}在makeStatusBarView(@Nullable RegisterStatusBarResult result)中的 createNavigationBar(result); 就是加载导航栏  直接注释掉就可以了

2、在DisplayPolicy.java中去掉底部导航栏

 public boolean hasNavigationBar() {return mHasNavigationBar;}/*** Return the display height available after excluding any screen* decorations that could never be removed in Honeycomb. That is, system bar or* button bar.*/public int getNonDecorDisplayHeight(int fullWidth, int fullHeight, int rotation, int uiMode,DisplayCutout displayCutout) {int height = fullHeight;if (hasNavigationBar()) {final int navBarPosition = navigationBarPosition(fullWidth, fullHeight, rotation);if (navBarPosition == NAV_BAR_BOTTOM) {height -= getNavigationBarHeight(rotation, uiMode);}}if (displayCutout != null) {height -= displayCutout.getSafeInsetTop() + displayCutout.getSafeInsetBottom();}return height;}/*** Return the display width available after excluding any screen* decorations that could never be removed in Honeycomb. That is, system bar or* button bar.*/public int getNonDecorDisplayWidth(int fullWidth, int fullHeight, int rotation, int uiMode,DisplayCutout displayCutout) {int width = fullWidth;if (hasNavigationBar()) {final int navBarPosition = navigationBarPosition(fullWidth, fullHeight, rotation);if (navBarPosition == NAV_BAR_LEFT || navBarPosition == NAV_BAR_RIGHT) {width -= getNavigationBarWidth(rotation, uiMode);}}if (displayCutout != null) {width -= displayCutout.getSafeInsetLeft() + displayCutout.getSafeInsetRight();}return width;}根据hasNavigationBar()判断是否有导航栏来就是显示屏幕宽度和高度所以修改为:public boolean hasNavigationBar() {-  return mHasNavigationBar;+ return false;}

3、默认隐藏导航栏

设置导航栏高度为0
路径:frameworks\base\core\res\res\values\demins.xml
<dimen name="navigation_bar_height">48dp</dimen>
navigation_bar_height 导航栏高度设置为0

参考

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/873978.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

AI赋能下的人体摔倒识别技术:深度解析与应用前景

引言 随着人工智能技术的快速发展&#xff0c;AI赋能的解决方案在各行各业中展现出巨大的潜力。特别是在安全监控和健康护理领域&#xff0c;AI技术的应用不仅提高了效率&#xff0c;还极大地提升了安全性。本文将深入探讨思通数科&#xff08;南京&#xff09;信息技术有限公…

【Matlab】RBF径向基神经网络回归预测算法(附代码)

资源下载&#xff1a; https://download.csdn.net/download/vvoennvv/89564332 资源合集&#xff1a; https://download.csdn.net/download/vvoennvv/89564427 目录 【Matlab】BP 神经网络回归预测算法 【Matlab】CNN-LSTM回归预测 卷积神经网络-长短期记忆神经网络组合模型 …

昇思学习打卡-23-生成式/CycleGAN图像风格迁移互换

文章目录 模型介绍网络结构数据集可视化网络的其他细节模型推理 模型介绍 CycleGAN(Cycle Generative Adversarial Network) 即循环对抗生成网络&#xff0c;实现了一种在没有配对示例的情况下学习将图像从源域 X 转换到目标域 Y 的方法。 该模型一个重要应用领域是域迁移(Do…

vue 侧边锚点外圆角

环境&#xff1a;uniapp、vue3、unocss、vant4 效果&#xff1a; 代码 主要是&#xff1a;pointTop 、pointCentent 、pointBottom&#xff0c;这三个样式 html <div v-show"!showPoint" class"fixedLeftDiv"><div><div class"pointT…

XXE:XML外部实体引入

XXE漏洞 如果服务器没有对客户端的xml数据进行限制&#xff0c;且版本较低的情况下&#xff0c;就可能会产生xxe漏洞 漏洞利用流程 1.客户端发送xml文件&#xff0c;其中dtd存在恶意的外部实体引用 2.服务器进行解析 3.服务器返回实体引用内容 危害&#xff1a;任意文件读…

代码:前端与数据库交互的登陆界面

<!DOCTYPE html> <html lang"en"> <head> <meta charset"UTF-8"> <meta name"viewport" content"widthdevice-width, initial-scale1.0"> <title>登录</title> </head> <body>…

【Linux 14】进程间通信概念

文章目录 &#x1f308; 一、进程间通信的目的&#x1f308; 二、进程间通信的理解&#x1f308; 三、进程间通信的分类 &#x1f308; 一、进程间通信的目的 数据传输&#xff1a;一个进程需要将它的数据发送给另一个进程资源共享&#xff1a;多个进程之间共享同样的资源。通…

Java GC(垃圾回收)机制详解

Java GC&#xff08;垃圾回收&#xff09;机制详解 1、GC触发的条件2、GCRoots的对象类型 &#x1f496;The Begin&#x1f496;点点关注&#xff0c;收藏不迷路&#x1f496; 在Java的世界里&#xff0c;内存管理是自动进行的&#xff0c;其中垃圾回收&#xff08;Garbage Col…

【JAVA多线程】Future,专为异步编程而生

目录 1.Future 2.CompletableFuture 2.1.为什么会有CompletableFuture&#xff1f; 2.2.使用 2.2.1.提交任务获取结果 2.2.2.回调函数 2.2.3.CompletableFuture嵌套问题 1.Future Java中的Future接口代表一个异步计算。其提供了一组规范用来对异步计算任务进行管理控制…

MySQL8的备份方案——增量备份(CentOS)

MySQL8的增量备份 一、安装备份工具二、备份数据三、准备恢复所需的备份数据四、 恢复备份文件 点击跳转全量(完全)备份 点击跳转差异备份 点击跳转压缩备份 一、安装备份工具 官网 下载地址 备份所用工具为percona-xtrabackup 如果下方安装工具的教程失效&#xff0c;请点击…

PACS-医学影像信息管理系统,全影像科室PACS源码,内置包括MPR、CMPR、VR等三维处理功能

PACS系统可以覆盖医院现有放射、CT、MR、核医学、超声、内镜、病理、心电等绝大部分DICOM和非DICOM检查设备&#xff0c;支持从科室级、全院机、集团医院级乃至到区域PACS的平滑扩展&#xff0c;能够与医院HIS、集成平台的有效集成和融合&#xff0c;帮助医院实现了全院医学影像…

Qt Style Sheets-使用样式表自定义 Qt 部件

使用样式表自定义 Qt 部件 在使用样式表时&#xff0c;每个小部件都被视为具有四个同心矩形的框&#xff1a;边距矩形、边框矩形、填充矩形和内容矩形。框模型对此进行了更详细的描述。 盒模型 以下是四个同心矩形在概念上的呈现方式&#xff1a; 边距超出边框。边框绘制在边…

【深入C++】二叉搜索树

文章目录 什么是二叉搜索树二叉搜索树的接口1.查找操作2.插入操作3.中序遍历4.删除操作 所有代码总结 什么是二叉搜索树 二叉搜索树&#xff08;Binary Search Tree, BST&#xff09;是一种特殊的二叉树&#xff0c;其每个节点最多有两个子节点&#xff0c;分别称为左子节点和…

C++实现数组中是否存在递增三元组的巧妙方法【奇思妙想】

C实现数组中是否存在递增三元组的巧妙方法 在解决数组问题时&#xff0c;尤其是涉及到子序列的查找&#xff0c;我们需要考虑时间复杂度和空间复杂度&#xff0c;以确保算法的效率。我们将介绍一种高效的解决方案&#xff0c;详细讲解其思路和实现。 问题描述 给你一个整数数…

Linux环境下dockes使用MongoDB,上传zip文件如何解压并备份恢复到MongoDB数据库中

1、准备 Docker 和 MongoDB 容器 建议主机端口改一下 docker run --name mongodb -d -p 27018:27017 mongo 2. 创建一个工作目录并将 zip 文件上传到dockers容器中 docker cp data.zip mongodb:/data.zip 3. 在 MongoDB 容器中解压 zip 文件&#xff08;也可以解压完再复制…

C++仿函数

在C中&#xff0c;我们经常需要对类中的元素进行比较&#xff0c;例如在排序、查找等操作中。为了使类更加灵活&#xff0c;我们可以通过自定义比较函数来实现不同的比较方式。在本文中&#xff0c;我们将探讨如何在类中使用仿函数和 Lambda 表达式来定义自定义比较函数。 1. …

《C++并发编程实战》笔记(三)

三、线程间共享数据的保护 多个线程同时访问修改共享的数据时&#xff0c;如果不加以控制&#xff0c;可能会造成未知的错误&#xff0c;为了解决这个问题&#xff0c;需要采取特殊的手段保证数据在各个线程间可以被正常使用。 这里介绍使用互斥量保护数据的方法。 3.1 使用互…

基础vrrp(虚拟路由冗余协议)

一、VRRP 虚拟路由冗余协议 比如交换机上联两个路由器&#xff0c;由两个路由虚拟出一台设备设置终端设备的网关地址&#xff0c;两台物理路由的关系是主从关系&#xff0c;可以设置自动抢占。终端设备的网关是虚拟设备的ip地址&#xff0c;这样&#xff0c;如果有一台路由设备…

pytorch学习(十一)checkpoint

当训练一个大模型数据的时候&#xff0c;中途断电就可以造成已经训练几天或者几个小时的工作白做了&#xff0c;再此训练的时候需要从epoch0开始训练&#xff0c;因此中间要不断保存&#xff08;epoch&#xff0c;net&#xff0c;optimizer&#xff0c;scheduler&#xff09;等…

深入探索:Stable Diffusion 与传统方法对比:优劣分析

深入探索&#xff1a;Stable Diffusion 与传统方法对比&#xff1a;优劣分析 一、引言 随着人工智能和深度学习的发展&#xff0c;优化算法在神经网络训练中的重要性日益凸显。传统的优化方法&#xff0c;如随机梯度下降&#xff08;SGD&#xff09;、动量法和Adam等&#xf…