Home > Software design >  How to change the backgorundColor of BasicTextField in jetpack compose?
How to change the backgorundColor of BasicTextField in jetpack compose?

Time:10-05

In case of a TextField we can change the backgroundColor of the text field as follows

TextField(
    value = text.value,
    onValueChange = { text.value = it },
    colors = TextFieldDefaults.textFieldColors(backgroundColor =  Color.Red)
)

But, there is no such thing in BasicTextField

CodePudding user response:

You can use Modifier.background in the same way as with any other view that has no custom decoration(as in case of TextField)

BasicTextField(
    value = text, onValueChange = { text = it },
    modifier = Modifier.background(Color.Red)
)
  • Related