如何改善撰写中大纲按钮的视图?

How to improve view of outlinedbutton in compose?

提问人:christianalready 提问时间:11/15/2023 最后编辑:christianalready 更新时间:11/23/2023 访问量:30

问:

当我单击元素并且它是焦点时,我的暗模式和背景有问题。 我找不到哪个更改了电子邮件文本标签的背景?

class TextFieldColors internal constructor(
    private val focusedTextColor: Color,
    private val unfocusedTextColor: Color,
    private val disabledTextColor: Color,
    private val errorTextColor: Color,
    private val focusedContainerColor: Color,
    private val unfocusedContainerColor: Color,
    private val disabledContainerColor: Color,
    private val errorContainerColor: Color,
    private val cursorColor: Color,
    private val errorCursorColor: Color,
    private val textSelectionColors: TextSelectionColors,
    private val focusedIndicatorColor: Color,
    private val unfocusedIndicatorColor: Color,
    private val disabledIndicatorColor: Color,
    private val errorIndicatorColor: Color,
    private val focusedLeadingIconColor: Color,
    private val unfocusedLeadingIconColor: Color,
    private val disabledLeadingIconColor: Color,
    private val errorLeadingIconColor: Color,
    private val focusedTrailingIconColor: Color,
    private val unfocusedTrailingIconColor: Color,
    private val disabledTrailingIconColor: Color,
    private val errorTrailingIconColor: Color,
    private val focusedLabelColor: Color,
    private val unfocusedLabelColor: Color,
    private val disabledLabelColor: Color,
    private val errorLabelColor: Color,
    private val focusedPlaceholderColor: Color,
    private val unfocusedPlaceholderColor: Color,
    private val disabledPlaceholderColor: Color,
    private val errorPlaceholderColor: Color,
    private val focusedSupportingTextColor: Color,
    private val unfocusedSupportingTextColor: Color,
    private val disabledSupportingTextColor: Color,
    private val errorSupportingTextColor: Color,
    private val focusedPrefixColor: Color,
    private val unfocusedPrefixColor: Color,
    private val disabledPrefixColor: Color,
    private val errorPrefixColor: Color,
    private val focusedSuffixColor: Color,
    private val unfocusedSuffixColor: Color,
    private val disabledSuffixColor: Color,
    private val errorSuffixColor: Color,
) {

outlined

我已经测试了几乎所有的,但我找不到它。

编辑: 更改此黑色背景颜色,它应该是透明的。enter image description here

例:

  textFieldDefault: TextFieldColors = OutlinedTextFieldDefaults.colors(
        disabledTextColor = Color.Gray,
        focusedContainerColor = Color.White,
        unfocusedContainerColor = Color.White,
        disabledContainerColor = Color.White,
        focusedSuffixColor = Color.Green,
        cursorColor = Color.Black,
        disabledBorderColor = if (isInputError) Color.Red else Color.Gray,
        disabledLabelColor = Color.Blue,
    ),
    textFieldError: TextFieldColors = OutlinedTextFieldDefaults.colors(
        errorBorderColor = Color.Red,
        unfocusedLeadingIconColor = Color.Red,
        focusedLeadingIconColor = Color.Red,
        cursorColor = Color.Gray,
        focusedBorderColor = Color.Red,
        unfocusedBorderColor = Color.Red
    ),

    OutlinedTextField(
        value = value,
        onValueChange = {
            onValueChange(it)
        },
        modifier = Modifier.fillMaxWidth(),
        colors = if (!isInputError) textFieldDefault else textFieldError,
        shape = RoundedCornerShape(8.dp),
        singleLine = true,
    [...]

这是代码,因为我主要寻求代码帮助。

Android Kotlin 颜色 android-jetpack-compose

评论

1赞 tomerpacific 11/15/2023
您想要的输出会是什么样子?是否要在文本输入聚焦时更改其轮廓?
0赞 christianalready 11/16/2023
是的,我想在它聚焦时更改它,通常它位于电子邮件图标的右侧,例如:图标“电子邮件”当它聚焦时,它是这样的,但电子邮件的背景看起来很糟糕,我无法更改它
0赞 tomerpacific 11/16/2023
是否要更改轮廓的颜色或图标的颜色?你说的是两件不同的事情。或者您希望文本“E-mail”的颜色不同?
0赞 christianalready 11/16/2023
感谢您的回答,我已经编辑了我的帖子。看屏幕
0赞 tomerpacific 11/16/2023
您能分享一下您现在拥有的文本输入代码以及您到底尝试了什么吗?

答: 暂无答案