1、實作沉浸式導航欄效果
1)在config.json中配置如下:
"module": {
"abilities": [{
"metaData": {
"customizeData": [{
"name": "hwc-theme",
"value": "androidhwext:style/Theme.Emui.Translucent.NoTitleBar"
}]
}
...
}]
}
2)在Ability代碼onStart方法中編寫
getWindow().addFlags(WindowManager.LayoutConfig.MARK_TRANSLUCENT_NAVIGATION);
2、頁面跳轉及傳遞參數
參數可以是模型、字元串等
Intent intent = new Intent();
List<String> list = new ArrayList<String>();
list.add(token);
list.add("2");
intent.setParam(Const.ABILITY_PARAMETER_KEY, (Serializable)list);
present(new NoticeAbilitySlice(), intent);
3、常用三方庫彙總
https://gitee.com/openharmony-tpc/tpc_resource
https://developer.huawei.com/consumer/cn/forum/topic/0202539543310340012?fid=0101303901040230869
4、華為官方教程
https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ui-java-custom-layouts-0000001092683918
5、設定圖檔圓角
img.setCornerRadius(10);//設定圓角