gpt4 book ai didi

android - 暗模式下奇怪的错误颜色文本撰写

转载 作者:行者123 更新时间:2023-12-04 07:18:29 25 4
gpt4 key购买 nike

嗨,我是新手,我正在尝试调试这个奇怪的文本颜色错误
颜色应该是白色的,它就像一个灰色的黑暗,一旦我将它们滚动到视线之外并滚动回之前的位置,它似乎就会消失并设置为白色。
很确定之前有人遇到过这个错误,我错过了什么吗?为什么会发生此错误?
编辑:这只发生在我的手机激活暗模式时。如果我停用它并在 TodoTheme(...) 中设置 false/true 一切都会按预期工作。
最简单的重现代码:

setContent {
TodoTheme {
TodoScreen()
}
}

@Composable
fun TodoScreen(
) {
val text = "This is a big text that will make color change and won't be very much visible for the user, why does this happen?"
LazyColumn(){
items(listOf(text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text,text)) { string ->
Text(text = string, color = MaterialTheme.colors.onSurface)
}
}
}
默认情况下,颜色是一种(我认为这不是颜色问题):
val LightThemeColors = lightColors(
primary = Purple700,
primaryVariant = Purple800,
onPrimary = Color.White,
secondary = Color.White,
onSecondary = Color.Black,
background = Color.White,
onBackground = Color.Black,
surface = Color.White,
onSurface = Color.Black,
error = Red800,
onError = Color.White
)

val DarkThemeColors = darkColors(
primary = Purple300,
primaryVariant = Purple600,
onPrimary = Color.Black,
secondary = Color.Black,
onSecondary = Color.White,
background = Color.Black,
onBackground = Color.White,
surface = Color.Black,
onSurface = Color.White,
error = Red300,
onError = Color.Black
)
这是一个视频,您将能够准确地观看正在发生的事情。这是在红米 Note 8 Pro 上。
https://www.youtube.com/watch?v=MwVO62NXCQU
和图像:
enter image description here

最佳答案

编辑:

<style name="AppTheme" parent="...">
<!-- Customize your theme here. -->
<item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
</style>
您可以在用于应用程序的主题中添加此行,即使启用了强制暗模式,它也不会在暗模式下覆盖应用程序
原始答案如下
如果您使用的是 Redmi 手机,并且仅在手机中启用暗模式时出现此问题,请转到设置 -> 显示 -> 更多暗模式选项,然后从应用列表中取消选中您的应用以查看它是否正常工作
但是我还没有找到默认打开这个东西的解决方案。一旦我发现,我会更新这个答案。
Select Dark Mode From Settings
Select More Dark Mode Options
Find your app from the individual apps list and turn off the toggle

关于android - 暗模式下奇怪的错误颜色文本撰写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68651348/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com