如何Android中自定义Navigationbar

2025-03-06 03:39:11
推荐回答(1个)
回答1:

在start()方法里可以看到NavigationBar是在那时候被添加进来,但只是添加,决定它显示还是隐藏是在后面控制的。
  @Override
  public void start() {
  mDisplay = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE))
  .getDefaultDisplay();
  updateDisplaySize();

  /// M: Support Smartbook Feature.
  if (SIMHelper.isMediatekSmartBookSupport()) {
  /// M: [ALPS01097705] Query the plug-in state as soon as possible.
  mIsDisplayDevice = SIMHelper.isSmartBookPluggedIn(mContext);
  Log.v(TAG, "start, mIsDisplayDevice=" + mIsDisplayDevice);
  }

  super.start(); // calls createAndAddWindows()

  addNavigationBar();

  // Lastly, call to the icon policy to install/update all the icons.
  mIconPolicy = new PhoneStatusBarPolicy(mContext);

  mHeadsUpObserver.onChange(true); // set up
  if (ENABLE_HEADS_UP) {
  mContext.getContentResolver().registerContentObserver(
  Settings.Global.getUriFor(SETTING_HEADS_UP), true,
  mHeadsUpObserver);
  }
  }