Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArkUI - 自定义卡片样式 #29

Open
cnwutianhao opened this issue Mar 10, 2024 · 0 comments
Open

ArkUI - 自定义卡片样式 #29

cnwutianhao opened this issue Mar 10, 2024 · 0 comments

Comments

@cnwutianhao
Copy link
Owner

HarmonyOS API 9 没有提供原生的卡片样式,我定义了一个卡片样式,可以方便大家在日常开发中使用。

效果图:

卡片样式代码如下:

@Styles function card() {
  .width('95%')
  .padding(20)
  .backgroundColor(Color.White)
  .borderRadius(15)
  .shadow({ radius: 6, color: '#1F000000', offsetX: 2, offsetY: 4 })
}

使用卡片样式:

@Entry
@Component
struct Test {
  build() {
    Column({ space: 10 }) {
      Row() {
        Text('卡片样式')
      }
      .card()
      .margin({ top: 20, bottom: 10 })
      .justifyContent(FlexAlign.SpaceEvenly)
    }
    .width('100%')
    .height('100%')
    .backgroundColor('#F1F2F3')
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant