HarmonyOS 鸿蒙Next中HdsNavigation/HdsNavDestination如何设置状态栏部分也模糊?
HarmonyOS 鸿蒙Next中HdsNavigation/HdsNavDestination如何设置状态栏部分也模糊?

现在状态栏是透明的,比较割裂。
更多关于HarmonyOS 鸿蒙Next中HdsNavigation/HdsNavDestination如何设置状态栏部分也模糊?的实战教程也可以访问 https://www.itying.com/category-93-b0.html
5 回复
有设置沉浸式吗,沉浸式之后用 padding: { top: xx }, 导航栏的模糊颜色应该也会覆盖到状态栏那里
更多关于HarmonyOS 鸿蒙Next中HdsNavigation/HdsNavDestination如何设置状态栏部分也模糊?的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
Navigation设置padding不会延申标题栏高度。
onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
let windowClass: window.Window | undefined = undefined;
windowStage.getMainWindow((err: BusinessError, data) => {
data.setWindowLayoutFullScreen(true)
if (err.code) {
console.error('Failed to obtain the main window. Cause: ' + JSON.stringify(err));
return;
}
windowClass = data;
console.info('Succeeded in obtaining the main window. Data: ' + JSON.stringify(data));
let sysBarProps: window.SystemBarProperties = {
statusBarColor: 'rgba(0, 0, 0, 0)', // 设置状态栏颜色为透明
};
windowClass.setWindowSystemBarProperties(sysBarProps, (err) => {
if (err.code) {
console.error('Failed to set the system bar properties. Cause: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in setting the system bar properties.');
});
});
windowStage.loadContent('pages/Index', (err) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
});
}
这个可以设置状态栏的颜色呢,尝试一下呢
在HarmonyOS Next中,HdsNavigation/HdsNavDestination组件可通过设置blurStyle属性实现状态栏模糊效果。具体使用WindowManager.setWindowBlur方法,传入模糊半径参数调整模糊程度。示例代码:windowManager.setWindowBlur(blurRadius),其中blurRadius数值控制模糊强度。需在页面初始化时调用,确保状态栏与导航栏视觉统一。


