Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
要设置对话框等组件的背景暗度,在Android中我们可以使用该setDimAmount功能。
setDimAmount
dialog.getWindow().setDimAmount(0.5);
在 HarmonyOS 中有什么替代方案?
dialog.show(); Optional<WindowManager.LayoutConfig> configOpt = dialog.getWindow().getLayoutConfig(); configOpt.ifPresent(config -> { config.dim = 0.0f; dialog.getWindow().setLayoutConfig(config); });
之后尝试配置相应窗口的属性即可dialog.show()。
dialog.show()