1

To set the background dimness of a component like dialog box, in Android we can use the setDimAmount function.

dialog.getWindow().setDimAmount(0.5);

What is the alternative for this in HarmonyOS?

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
Soham
  • 37
  • 5

1 Answers1

0
dialog.show();
Optional<WindowManager.LayoutConfig> configOpt = dialog.getWindow().getLayoutConfig();
configOpt.ifPresent(config -> {
   config.dim = 0.0f;
   dialog.getWindow().setLayoutConfig(config);
});

Just try to configure the attributes of the corresponding window after dialog.show().

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108