鸿蒙harmonyos全屏显示,app全屏显示,取消标题栏和状态栏

第一步:

        MainAbilitySlice中添加代码,使得用沉浸式状态栏,来取消状态栏

public class MainAbilitySlice extends AbilitySlice {

@Override
public void onStart(Intent intent) {
    super.onStart(intent);
    super.setUIContent(ResourceTable.Layout_ability_main);

    getWindow().addFlags(WindowManager.LayoutConfig.MARK_FULL_SCREEN);
}

@Override
public void onActive() {
    super.onActive();
}

@Override
public void onForeground(Intent intent) {
    super.onForeground(intent);
}

}

第二步:

        取消标题栏,在项目的config.json中添加以下代码


“abilities”: [
{

“metaData”:{

      "customizeData":[
        {
          "name": "hwc-theme",
          "value": "androidhwext:style/Theme.Emui.Light.NoTitleBar",
          "extra": ""
        }
      ]
    }

} ]

效果:

 

都看到这里了,解决了您问题的话不妨点个赞~谢谢老铁