美文网首页
Android13 修改标题栏status_bar高度

Android13 修改标题栏status_bar高度

作者: MrDemo | 来源:发表于2024-07-04 15:35 被阅读0次

/home/wp/QZ-T527/T527_Android13_V1.0_20231205/android/frameworks/base/core/res/res/values/dimens.xml
修改标签status_bar_height_default

<dimen name="status_bar_height_default">60dp</dimen>

代码跟踪,当我只修改status_bar_height与status_bar.xml后我发现并没有发生改变,最后发现是在
/home/wp/QZ-T527/T527_Android13_V1.0_20231205/android/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java中发现进行了动态的赋值

 private void updateStatusBarHeight() {
        final int waterfallTopInset =
                mDisplayCutout == null ? 0 : mDisplayCutout.getWaterfallInsets().top;
        ViewGroup.LayoutParams layoutParams = getLayoutParams();
        mStatusBarHeight = SystemBarUtils.getStatusBarHeight(mContext);
      //省略部分代码
    }

跟踪SystemBarUtils类发现使用的是status_bar_height_default的值

    public static int getStatusBarHeight(Resources res, DisplayCutout cutout) {
        final int defaultSize = res.getDimensionPixelSize(R.dimen.status_bar_height_default);
        final int safeInsetTop = cutout == null ? 0 : cutout.getSafeInsetTop();
        final int waterfallInsetTop = cutout == null ? 0 : cutout.getWaterfallInsets().top;
        // The status bar height should be:
        // Max(top cutout size, (status bar default height + waterfall top size))
        return Math.max(safeInsetTop, defaultSize + waterfallInsetTop);
    }

相关文章

  • 关于图片清晰度问题

    今天测试给我了个建议修改的BUG,说标题栏中的图标不是太清楚, 标题栏中有个南理工的学校标志,由于标题栏整体高度就...

  • Android 开发错题本

    一 设置标题栏 和 状态栏相同背景色. 获取状态栏高度 布局文件 二 , 隐藏标题栏 和 状态栏 (修改主题Sty...

  • flutter标题栏Appbar的封装

    设置标题栏高度PreferredSize Flutter的标题栏通常使用AppBar, 但是AppBar并没有提供...

  • 状态栏、导航栏、PopupWindow的使用

    1. 状态栏、标题栏、导航栏简介 绝对高度 = 高度 + 状态栏高度 + 导航栏高度RealHeight = He...

  • Android配置xml去掉标题栏

    自动创建的AppTheme为: 修改后的: 连标题栏和状态栏都去了 AndroidManifest.xml中修改如下

  • android winodw相关知识

    如何获取状态栏和标题栏的高度?1.获取状态栏高度:decorView是window中的最顶层view,可以从win...

  • Qt 获取标题栏高度

    QRect desktopRect = QApplication::desktop()->availableGeo...

  • 常量如何写

    常量:固定不变的值 什么时候会用到常量? 控件的高度:当要把一些控件的高度写成固定的,如把标题栏的高度固定为一个3...

  • 去掉标题栏

    去掉标题栏有两种方法 1.修改主题 把Theme.App.Compat.Light.DarkActionBar主题...

  • 打造一个通用的TitleView

    在开发应用的过程中,大部分应用应该都是有标题栏的。通常情况下,我们所使用的标题栏的高度什么其他设置之类的基本上都是...

网友评论

      本文标题:Android13 修改标题栏status_bar高度

      本文链接:https://www.haomeiwen.com/subject/wyoicjtx.html