HarmonyOS 华为账号一键登录中,按钮颜色如何根据应用的主题色而改变?

如题:HarmonyOS 华为账号一键登录中,按钮颜色如何根据应用的主题色而改变?

阅读 736
1 个回答

华为账号Button登录组件,设置背景色和圆角可参考:

https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/account-api-component-manager-V5\#section4717249182518

borderRadius:可设置圆角半径。style:可设置BUTTON\_CUSTOM为背景色自定义。customButtonParams:可自定义背景色和文字颜色(文字颜色只有黑和白)。

属性设置示例可参考下面链接中的示例:

https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/account-api-component-manager-V5\#section9921053045

参考示例:

LoginWithHuaweiIDButton({
  params: {
    // LoginWithHuaweiIDButton支持的样式。
    style: loginComponentManager.Style.BUTTON_CUSTOM, //BUTTON_CUSTOM为背景色可自定义
    // LoginWithHuaweiIDButton的边框圆角半径。
    borderRadius: 0, //可设置圆角半径
    customButtonParams: {
      backgroundColor: Color.Green, //可自定义
      fontColor: 1 //值为0和1,0-白色,1-黑色
    }
  }
})