HarmonyOS savebutton的使用影响图片保存?

savebutton位置影响保存功能,SaveButton和Text的位置互换,会影响保存的功能。

Row() {
  SaveButton({ text: SaveDescription.SAVE, buttonType: ButtonType.Normal })
    .fontColor(Color.White)
    .backgroundColor(Color.Black)
    .width(100)
    .onClick(async () => {
      if (this.imgBuffersMap.get(this.selectedIndex - 1)) {
        this.saveImage(this.imgBuffersMap.get(this.selectedIndex - 1)).then(() => {
          promptAction.showToast({
            message: $r("app.string.saveImgSuccess"),
            duration: 2000
          })
        }).catch(() => {
          promptAction.showToast({
            message: $r("app.string.saveImgFail"),
            duration: 2000
          })
        })
      }
    })
  Text(this.selectedIndex + "/" + this.imgUrls.length)
    .fontColor(Color.White)
    .fontSize(FontSizeUtil.getFontSize(15))
    .padding({ right: adapt(20) })
}
.width("100%")
.justifyContent(FlexAlign.SpaceBetween)
.padding({ bottom: adapt(30) })
阅读 612
1 个回答
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进