# StatusBarUtil **Repository Path**: hihopeorg/StatusBarUtil ## Basic Information - **Project Name**: StatusBarUtil - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-03-10 - **Last Updated**: 2021-10-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # StatusBarUtil **本项目是基于开源项目 StatusBarUtil 进行ohos化的移植和开发的,可以通过项目标签以及github地址(https://github.com/laobie/StatusBarUtil )追踪到原项目版本** #### 项目介绍 - 项目名称:StatusBarUtil - 所属系列:ohos的第三方组件适配移植 - 功能:实现沉浸式状态栏/变色状态栏 - 项目作者和维护人:hihope - 无原项目基线版本 - 联系方式:hihope@hoperun.com - 调用差异:无 - 原项目Doc地址:https://github.com/laobie/StatusBarUtil - 编程语言:Java #### 安装教程 方法1. 1. 将本三方库的har下载。 2. 启动 DevEco Studio,将下载的har包,导入工程目录“entry->libs”下。 3. 在entry级别下的build.gradle文件中添加依赖,在dependences标签中增加对libs目录下har包的引用。 ``` dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) …… } ``` 方法2. 1. 在工程的build.gradle的allprojects中,添加HAR所在的Maven仓地址 ``` repositories { maven { url 'http://106.15.92.248:8081/repository/Releases/' } } ``` 2. 在应用模块的build.gradle的dependencies闭包中,添加如下代码: ``` dependencies { implementation 'com.jaeger.ohos:statusbarutil:1.0.1' } ``` #### 效果演示 #### 使用说明 1.使用最多的主要功能类: - StatusBarUtil - 状态栏管理控制类 2.使用实例 设置状态栏带有透明度的颜色 ``` StatusBarUtil.setColor(getAbility(),mColor,mAlpha); ``` 代码说明: mColor为需要设置颜色的int值 mAlpha为设置状态栏的透明度,范围在0到255,越大越不透明 设置状态栏为透明 ``` StatusBarUtil.setTransparent(getAbility()); ``` 设置状态栏为指定透明度,需要传入根布局的id值 ``` StatusBarUtil.setTranslucent(getAbility(), alpha,ResourceTable.Id_directionalLayout4); ``` 为顶部带有图片的界面设置状态栏透明,需要传入根布局id值和布局中需要向下偏移的控件 ``` StatusBarUtil.setTranslucentForImageView(getAbility(), alpha, mViewNeedOffset, ResourceTable.Id_DependentLayout55); ``` #### 版本迭代 - v1.0.1 #### 版权和许可信息 - Apache License 2.0