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

4、修改完成记得执行快速编译命令

make snod

  然后重启编译备,模拟器或者设备即可看到效果。

参考

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

如若内容造成侵权/违法违规/事实不符,请联系一条长河网进行投诉反馈,一经查实,立即删除!

相关文章

SpringBoot+Session+redis实现分布式登录

SpringBootSessionRedis实现分布式登录功能实现 文章目录 目录 文章目录 前言 一、引库 二、修改配置文件 三、使用 四、解决乱码问题 1.引库 2.配置redis序列化 3.配置Session-Redis序列化 前言 这里简单介绍一下&#xff0c;如果你想多台机器部署你的项目的话&#xff0c;在…

重大突破!OpenAI 推出 GPT-4o mini,AI 领域再掀波澜!

北京时间 7 月 18 日晚&#xff0c;OpenAI 重磅推出“小模型”GPT-4o mini&#xff0c;其在文本智能和多模态推理方面展现出卓越性能&#xff0c;超越 GPT-3.5 Turbo&#xff0c;在 LMSYS“聊天机器人对战”排行榜上也力压 GPT-4。 GPT-4o mini 支持 128K Token 的长上下文窗口…

一起学Java(1)-新建一个Gradle管理的Java项目

一时兴起&#xff0c;也为了便于跟大家同步学习进展和分享样例代码&#xff0c;遂决定创建一个全新的Java项目&#xff0c;并通过Github与大家分享。本文就是记录该项目的创建过程以及其中的一些知识要点&#xff08;如Gradle等&#xff09;。为了紧跟技术潮流和提高操作效率&a…

污染物CMAQ模型的安装

CMAQ安装教程(基于intel编译器) 简介 CMAQ&#xff08;Community Multiscale Air Quality&#xff09;系统是由美国国家环境保护局&#xff08;EPA, Environmental Protection Agency&#xff09;于1998年发布&#xff0c;是用于估算臭氧、颗粒物、有毒化合物和酸沉降等大气污…

第5讲:Sysmac Studio中的硬件拓扑

Sysmac Studio软件概述 一、创建项目 在打开的软件中选择新建工程 然后在工程属性中输入工程名称,作者,类型选择“标准工程”即可。 在选择设备处,类型选择“控制器”。 在版本处,可以在NJ控制器的硬件右侧标签处找到这样一个版本号。 我们今天用到的是1.40,所以在软…

DocRED数据集

DocRED数据集文件夹包含多个JSON文件&#xff0c;每个文件都有不同的用途。以下是这些文件的用途解释以及哪个文件是训练集&#xff1a; 文件解释 dev.json&#xff1a;包含开发集&#xff08;验证集&#xff09;的数据&#xff0c;通常用于模型调优和选择超参数。 label_map…

工业4.0与智能制造解决方案(149页PPT下载)

工业4.0&#xff0c;也被称为第四次工业革命&#xff0c;是一场将先进信息技术与制造业深度融合的全球性变革。这一概念起源于2011年德国提出的高科技战略项目&#xff0c;旨在通过利用物联网&#xff08;IoT&#xff09;、大数据、云计算、人工智能&#xff08;AI&#xff09;…

海康威视工业相机SDK+Python+PyQt开发数据采集系统(支持软件触发、编码器触发)

海康威视工业相机SDKPythonPyQt开发数据采集系统&#xff08;支持软件触发、编码器触发&#xff09; pythonpyqt开发海康相机数据采集系统 1 开发软件功能&#xff1a; 支持搜索相机&#xff1a;Gige相机设备和USB相机设备支持两种触发模式&#xff1a;软件触发和编码器触发支…

Python基础知识——(005)

文章目录 P21——20. 比较运算符 P22——21. 逻辑运算符 P23——22. 位运算和运算符的优先级 P24——23. 本章总结和章节习题 P21——20. 比较运算符 示例3-17—比较运算符的使用&#xff1a; P22——21. 逻辑运算符 示例3-18—逻辑运算符的使用&#xff1a; print(True and T…

群管机器人官网源码

一款非常好看的群管机器人html官网源码 搭建教程&#xff1a; 域名解析绑定 源码文件上传解压 访问域名即可 演示图片&#xff1a; 群管机器人官网源码下载&#xff1a;客户端下载 - 红客网络编程与渗透技术 原文链接&#xff1a; 群管机器人官网源码

Python设计模式:巧用元类创建单例模式!

✨ 内容&#xff1a; 今天我们来探讨一个高级且实用的Python概念——元类&#xff08;Metaclasses&#xff09;。元类是创建类的类&#xff0c;它们可以用来控制类的行为。通过本次练习&#xff0c;我们将学习如何使用元类来实现单例模式&#xff0c;确保某个类在整个程序中只…

如何使用大语言模型绘制专业图表

过去的一年里&#xff0c;我相信大部分人都已经看到了大语言模型(后文简称LLM)所具备的自然语言理解和文本生成的能力&#xff0c;还有很多人将其应用于日常工作中&#xff0c;比如文案写作、资料查询、代码生成……今天我要向大家介绍LLM的一种新使用方式——绘图。这里说的绘…

昇思25天学习打卡营第19天| Diffusion扩散模型

扩散模型&#xff0c;特别是Denoising Diffusion Probabilistic Models&#xff08;DDPM&#xff09;&#xff0c;是一种从纯噪声开始&#xff0c;通过逐步去噪生成数据样本的技术。它在图像、音频、视频生成上都取得了不错的成果&#xff0c;比如OpenAI的GLIDE和DALL-E 2。 扩…

three完全开源扩展案例04-阵列模型

https://www.threelab.cn/three-cesium-examples/public/index.html#/codeMirror?navigationThree.js%E6%A1%88%E4%BE%8B[r166]&classifybasic&id%E9%98%B5%E5%88%97%E6%A8%A1%E5%9E%8B 更多案例 import * as THREE from three; import { OrbitControls } from three…

组队学习——贝叶斯分类器(二)

引言 在组队学习——贝叶斯分类器&#xff08;一&#xff09;中布置了一个鸢尾花分类的任务&#xff0c;以下是关于它的代码详解&#xff1a; 要求对鸢尾花数据集进行分类&#xff0c;如何进行数据预处理&#xff08;提示&#xff1a;将分类数据转换成定量数据&#xff09; 第2…

从PyTorch官方的一篇教程说开去(3.3 - 贪心法)

您的进步和反馈是我最大的动力&#xff0c;小伙伴来个三连呗&#xff01;共勉。 贪心法&#xff0c;可能是大家在处理陌生问题时候&#xff0c;最容易想到的办法了吧&#xff1f; 还记得小时候&#xff0c;国足请了位洋教练发表了一句到现在还被当成段子的话&#xff1a;“如…

AGI 之 【Hugging Face】 的【从零训练Transformer模型】之二 [ 从零训练一个模型 ] 的简单整理

AGI 之 【Hugging Face】 的【从零训练Transformer模型】之二 [ 从零训练一个模型 ] 的简单整理 目录 AGI 之 【Hugging Face】 的【从零训练Transformer模型】之二 [ 从零训练一个模型 ] 的简单整理 一、简单介绍 二、Transformer 1、模型架构 2、应用场景 3、Hugging …

Python爬虫实战案例(爬取文字)

爬取豆瓣电影的数据 首先打开"豆瓣电影 Top 250"这个网页&#xff1a; 按F12&#xff0c;找到网络&#xff1b;向上拉动&#xff0c;找到名称栏中的第一个&#xff0c;单机打开&#xff1b;可以在标头里看到请求URL和请求方式&#xff0c;复制URL&#xff08;需要用…

【网络安全】CrowdStrike 的 Falcon Sensor 软件导致 Linux 内核崩溃

CrowdStrike的Falcon Sensor软件&#xff0c;上周导致大量Windows电脑出现蓝屏故障&#xff0c;现在还被发现Linux内核系统崩溃也与CrowdStrike有关。 六月份&#xff0c;Red Hat警告其客户在使用版本为5.14.0-427.13.1.el9_4.x86_64的内核启动后&#xff0c;由Falcon Sensor进…

PostgreSQL异常:An I/O error occurred while sending to the backend

在使用PostgreSQL数据库批量写入数据的时候&#xff0c;遇到了一个问题&#xff0c;异常内容如下&#xff1a; Cause: org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.报错内容 报错提示1 Caused by: org.postgresql.util.PSQLExc…