HarmonyOS LoadingDialog可以自定义背景颜色吗?

HarmonyOS
2024-12-26 14:11:22
820浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
zbw_apple

参考demo:

import { LoadingDialog } from '@ohos.arkui.advanced.Dialog';
import { CustomColors } from '@kit.ArkUI';
class CustomThemeImpl implements CustomTheme {
  colors?: CustomColors;
  constructor(colors: CustomColors) {
    this.colors = colors;
  }
}
class CustomThemeColors implements CustomColors {
  fontPrimary = '#ffd0a300';
  iconSecondary = '#ffd000cd';
}
@Entry
@Component
struct Index {
  @State customTheme: CustomTheme = new CustomThemeImpl(new CustomThemeColors());
  dialogController: CustomDialogController = new CustomDialogController({
    builder: LoadingDialog({
      content: 'text',
      theme: this.customTheme,
    }),
    backgroundColor:Color.Red,
  });
  build() {
    Row() {
      Stack() {
        Column() {
          Button('dialog')
            .width(96)
            .height(40)
            .onClick(() => {
              this.dialogController.open();
            })
        }.margin({ bottom: 300 })
      }.align(Alignment.Bottom)
      .width('100%').height('100%')
    }
    .backgroundImageSize({ width: '100%', height: '100%' })
    .height('100%')
  }
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.

尝试在backgroundColor:Color.Red后面加上 backgroundBlurStyle:BlurStyle.NONE。

分享
微博
QQ
微信
回复
2024-12-26 17:05:08


相关问题
自定义弹框,遮罩背景颜色无法设置
1037浏览 • 1回复 待解决
HarmonyOS 如何自定义相机背景
890浏览 • 1回复 待解决
智慧推荐可以自定义app
8659浏览 • 1回复 待解决
HarmonyOS 自定义Popup arrow颜色怎么设置
626浏览 • 1回复 待解决
HarmonyOS 地图信息窗可以自定义布局
1092浏览 • 1回复 待解决
HarmonyOS 如何设置自定义弹框的颜色
752浏览 • 1回复 待解决
如何去除自定义弹窗的白色背景
3014浏览 • 1回复 待解决
HarmonyOS 自定义Dialog背景色透明问题
1955浏览 • 1回复 待解决
自定义颜色透明度如何实现?
1007浏览 • 1回复 待解决