HarmonyOS RichEditor 内容不居中显示?

如题:HarmonyOS RichEditor 内容不居中显示?

阅读 590
1 个回答

参考代码:

RichEditor({ controller: this.controllerRich})
  .width('100%')
  .height(40)
  .layoutWeight(1)
  .borderRadius(10)
  .backgroundColor(Color.Red)
  .margin({ top: 20 ,left:14,bottom:5})
  .key('RichEditor')
  .id('id')
  .placeholder('平台提倡文明用语,请温柔发言哦~',{font:{size:12},fontColor:'#999999'})
  .defaultFocus(true)
  .onReady(() => {
    this.controllerRich.addTextSpan("0123456789\n", {
      style: {
        fontColor: Color.Pink,
        fontSize: "32",
      },
      paragraphStyle: {
        textAlign: TextAlign.Center,
        leadingMargin: 16
      }
    })
  })

参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-basic-components-richeditor-V5

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进