参考文章:设置状态栏,调用setWindowSystemBarProperties不生效
我使用 setWindowSystemBarProperties 设置状态栏,不生效。
import window from '@ohos.window';
export default {
data: {
title: 'World'
},
setSystemBar() {
var windowClass = null;
window.getTopWindow((err, data) => {
windowClass = data;
var SystemBarProperties = {
statusBarColor: '#ca0522',
navigationBarColor: '#0456fa',
//以下两个属性从API Version7开始支持
isStatusBarLightIcon: true,
isNavigationBarLightIcon: false
};
windowClass.setSystemBarProperties(SystemBarProperties, (err, data) => {
if (err) {
console.error('Failed to set the system bar properties. Cause: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in setting the system bar properties. Data: ' + JSON.stringify(data));
});
});
}
}
后查阅文档发现api9无法使用,