当前位置: 首页 > news >正文

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

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

参考

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • 第八讲:Sysmac Studio控制器设置
  • 初识Maven
  • 深入浅出WebRTC—DelayBasedBwe
  • Python学习总结
  • 无人机侦察:一维相扫雷达技术详解
  • 某4G区域终端有时驻留弱信号小区分析
  • Nginx 怎样处理请求的重试机制?
  • Ubuntu22.04系统安装nodejs 14 保姆级教程
  • arm、AArch64、x86、amd64、x86_64 的区别
  • 【OSS对象存储】Springboot集成阿里云OSS + 私有化部署Minio
  • Redis 哨兵搭建
  • lua 游戏架构 之 游戏 AI (一)ai_base
  • 【电源专题】结合锂电池相关资料和华为手机聊聊锂离子电池使用条件限制
  • 使用 cURL 命令测试网站响应时间
  • Dubbo SPI 之路由器
  • 【知识碎片】第三方登录弹窗效果
  • Angularjs之国际化
  • echarts的各种常用效果展示
  • ERLANG 网工修炼笔记 ---- UDP
  • es6(二):字符串的扩展
  • express.js的介绍及使用
  • HTTP传输编码增加了传输量,只为解决这一个问题 | 实用 HTTP
  • Java 23种设计模式 之单例模式 7种实现方式
  • node入门
  • SpiderData 2019年2月23日 DApp数据排行榜
  • SQL 难点解决:记录的引用
  • Theano - 导数
  • TypeScript实现数据结构(一)栈,队列,链表
  • 闭包--闭包作用之保存(一)
  • 浏览器缓存机制分析
  • 使用API自动生成工具优化前端工作流
  • 使用docker-compose进行多节点部署
  • #162 (Div. 2)
  • #FPGA(基础知识)
  • #Z0458. 树的中心2
  • (4) PIVOT 和 UPIVOT 的使用
  • (Forward) Music Player: From UI Proposal to Code
  • (k8s)Kubernetes 从0到1容器编排之旅
  • (NO.00004)iOS实现打砖块游戏(十二):伸缩自如,我是如意金箍棒(上)!
  • (PyTorch)TCN和RNN/LSTM/GRU结合实现时间序列预测
  • (二)原生js案例之数码时钟计时
  • (二)丶RabbitMQ的六大核心
  • (一)基于IDEA的JAVA基础10
  • (转)创业的注意事项
  • (转)淘淘商城系列——使用Spring来管理Redis单机版和集群版
  • .net core使用ef 6
  • .net Stream篇(六)
  • .net web项目 调用webService
  • .NET Windows:删除文件夹后立即判断,有可能依然存在
  • .net 按比例显示图片的缩略图
  • .NET业务框架的构建
  • .one4-V-XXXXXXXX勒索病毒数据怎么处理|数据解密恢复
  • [ 2222 ]http://e.eqxiu.com/s/wJMf15Ku
  • [Android]创建TabBar
  • [Android]竖直滑动选择器WheelView的实现