淘先锋技术网

首页 1 2 3 4 5 6 7

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);//设置圆角