Ask Your Question
3

How to change the background color of a button in Jetpack Compose?

asked 2023-07-17 09:11:45 +0000

ladyg gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-07-17 09:19:02 +0000

lalupa gravatar image

To change the background color of a button in Jetpack Compose, you can use the 'backgroundColor' modifier. Here's an example:

Button(
    onClick = { /* Do something! */ },
    modifier = Modifier
        .background(color = Color.Green) // Set the background color
) {
    Text("Click me!")
}

In this example, the button will have a green background color. You can change the color value to any other color you like.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-07-17 09:11:45 +0000

Seen: 11 times

Last updated: Jul 17 '23