HarmonyOS 如何只是绘制一个圆形图片?

比如我想绘制一个用.width(10).height(10).borderRadius(5).backgroundColor('\#FFBB22')绘制一个圆形的图片,该用什么组件

阅读 507
1 个回答

可参考如下代码:

@Entry
@Component
struct Index4 {
  @State message: string = 'Hello World';

  build() {
    Column() {
      Row().width(100).height(100).borderRadius(50).backgroundColor('#FFBB22')
    }.width('100%').height('100%').justifyContent(FlexAlign.Center)
  }
}

也可以使用button:

Button().type(ButtonType.Circle).width(100).backgroundColor('#FFBB22')
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进