HarmonyOS AlertDialog.show与TextPickerDialog.show系统在暗黑模式下,设置背景色不生效
AlertDialog.show与TextPickerDialog.show系统在暗黑模式下,设置背景色backgroundColor不生效
export class DialogUtil {
// 文本选择器
static textPickerDialogShow(datas: Array<string>, currentSelected: number,
callBack: (value: TextPickerResult) => void) {
TextPickerDialog.show({
range: datas,
selected: currentSelected,
canLoop: false,
backgroundColor:$r("app.color.dialog_background"),
disappearTextStyle: {
color: $r("app.color.999"),
font: { size: $r("app.float.text_size_16"), weight: FontWeight.Normal }
},
textStyle: {
color: $r("app.color.999"),
font: { size: $r("app.float.text_size_16"), weight: FontWeight.Normal }
},
selectedTextStyle: { color: Color.Black, font: { size: $r("app.float.text_size_16"), weight: 600 } },
onAccept: (value: TextPickerResult) => {
callBack(value)
},
})
}
static alertDialogShow(message: string, sureTitle: string = '确定', sureClick?: () => void, cancelTitle?: string,
cancelClick?: () => void,) {
AlertDialog.show(
{
title: '提示',
backgroundColor:$r("app.color.dialog_background"),
message: message,
autoCancel: false,
alignment: DialogAlignment.Center,
gridCount: 4,
buttonDirection: DialogButtonDirection.HORIZONTAL,
buttons: cancelTitle != undefined ? [
{
value: cancelTitle,
fontColor: $r("app.color.999"),
action: cancelClick != undefined ? cancelClick : () => {
}
},
{
value: sureTitle,
fontColor: $r("app.color.theme"),
action: sureClick != undefined ? sureClick : () => {
}
},
] : [
{
value: sureTitle,
fontColor: $r("app.color.theme"),
action: sureClick != undefined ? sureClick : () => {
}
},
],
}
)
}
}
- 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.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
HarmonyOS
赞
收藏 0
回答 1
相关问题
HarmonyOS AlertDialog.show文字居中与颜色设置
833浏览 • 1回复 待解决
HarmonyOS popup设置背景色(设置不生效)
758浏览 • 1回复 待解决
AlertDialog.show创建的弹窗,如何主动消失
3233浏览 • 1回复 待解决
HarmonyOS 调用系统的AlertDialog.show()为什么系统状态栏没有遮罩?
390浏览 • 1回复 待解决
HarmonyOS 自定义弹窗设置背景色与实际效果不对,并且内部某个节点设置背景色不生效
381浏览 • 1回复 待解决
AlertDialog没有找到设置背景色API
1139浏览 • 1回复 待解决
暗黑模式下如何设置AlertDialog的title和message颜色?
943浏览 • 1回复 待解决
HarmonyOS 组件背景色通过数值设置带透明度的不生效
421浏览 • 1回复 待解决
HarmonyOS 如何设置渐变背景色?
2093浏览 • 1回复 待解决
HarmonyOS richtext组件在深色模式下背景色变黑,无法更改,需要变成白色
521浏览 • 1回复 待解决
HarmonyOS 如何自定义Dialog实现与AlertDialog一样静态show方法
395浏览 • 1回复 待解决
如何设置窗口的背景色
2441浏览 • 1回复 待解决
如何设置WebView的背景色?
1530浏览 • 1回复 待解决
HarmonyOS TextInput如何设置背景色为透明
512浏览 • 1回复 待解决
Button组件如何设置渐变背景色
3578浏览 • 1回复 待解决
HarmonyOS Select组件的背景色如何设置
512浏览 • 1回复 待解决
HarmonyOS 关于开屏背景色
528浏览 • 1回复 待解决
HarmonyOS 弹窗自带背景色
443浏览 • 1回复 待解决
使用js引擎 设置dom背景色无效
1290浏览 • 0回复 待解决
HarmonyOS Navigation的title能否设置渐变背景色
420浏览 • 1回复 待解决
HarmonyOS Tabs设置背景色会有一像素的间隔
467浏览 • 1回复 待解决
JSUI按钮 toolbar的按下背景色怎么去掉
5784浏览 • 1回复 待解决
HarmonyOS List组如何将背景色设置透明
446浏览 • 1回复 待解决
HarmonyOS Text组件,富文本使用Span设置背景色无效
1504浏览 • 1回复 待解决
可以参考以下代码:
设置深色模式不随系统改变。
参考链接:
https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-inner-application-applicationcontext-V5
深色模式的适配,参考文档:
https://developer.huawei.com/consumer/cn/doc/design-guides/dark-mode-0000001823255497