我在实况窗中,使用了 PickupLayout,并给 descPic 传递了一个 image.PixelMap 作为参数,结果运行报错:
Failed to start TicketGrabbingReminderLiveView: 401 Parameter error. The type of layoutData.descPic mustbe string [or the parameter length exceeds the limit].
我检查了图片的大小,原始大小为 12KB,没有超过文档里规定的 30KB。
图片超过大小限制了,image.PixelMap大小不能大于30KB,不是指原图不能大于30KB,可以调用下面方法检查下大小,icon.getPixelBytesNumber()的值除以1024不能大于30。
图片压缩可参考此文档
https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-image-V5\#imagepacker