Questions tagged [android-jetpack-compose-button]
30 questions
3
votes
2 answers
How to set JetpackCompose Button Background Color
I tried the code in background color on Button in Jetpack Compose
Button(
onClick = { },
backgroundColor = Color.Yellow) {
}
but it doesn't recognize backgroundColor anymore.
I tried the below
Button(
modifier =…

Elye
- 53,639
- 54
- 212
- 474
2
votes
1 answer
Can I put animation fade in with duration between button state enable and disable in jetpack compose?
This is how i create my button in compose
Button(
modifier = modifier,
enabled = enabled.value,
onClick = {}
) {
Text(text = text)
}

Nirav Rangapariya
- 73
- 5
2
votes
2 answers
Why don't Indication work for Button or Icons?
As solved here, I disable the tap flashing by setting the indication to null.
However, this is not working for Button or Icons?!

Ralf Wickum
- 2,850
- 9
- 55
- 103
1
vote
2 answers
Jetpack compose: customize radio button group to achieve segmented buttons
iOS has Segmented controls like this.
I wanna have this in Android by using jetpack compose and I checked there is not build-in like this, and this UI in material 3 doesn't support jetpack compose now. What can I do? Totally customize the radio…

Harvey Xie
- 81
- 4
1
vote
2 answers
Make a button Unclickable from onClick
I am trying to use Compose and Kotlin in this code to make the button unclickable when counter == 3.
When I run the code and counter presumably is 3, the button stays clickable and wont change to uncklickable.
var counter = 0
var isClickable by…

abd1dab1ul
- 11
- 1
1
vote
2 answers
How to change the color of ripple effect of a Button
For some reason, I'm unable to change the color of the ripple effect of a Button. What am I doing wrong here?
androidx.compose.material.Button(
onClick = onClick,
modifier = modifier
.indication(
interactionSource =…

bvk256
- 1,837
- 3
- 20
- 38
1
vote
1 answer
How to handle border and background in compose shape?
In the code the image border only on the sides, not on the corners.
for the button, the background goes out of the shape/border.
I only managed to "fix" the button by using a fixed height but I don't understand why a fixed height help and I wonder…

AloneWalker
- 59
- 6
1
vote
1 answer
Jetpack compose dynamic button ID
I can change the background color of 1 single button, by pressing it and updating the relevant State, as follows:
@Composable
fun makeButtons() {
var isPressed by remember { mutableStateOf(false) }
val color = if (isPressed) Color.Red else…

Ali
- 107
- 1
- 8
0
votes
2 answers
Android Compose contraintLayout has a text inside, which if it's long -> it will go out of it's parent
This is my code:
@Preview
@Composable
private fun composable(){
ConstraintLayout(
modifier = Modifier
.padding(all = 8.dp)
) {
val (title, type) = createRefs()
Image(
painter =…

rosu alin
- 5,674
- 11
- 69
- 150
0
votes
0 answers
Using compose bom in library results in resolved empty version in a non-bom module
I'm working on a library Central Compose Library that uses Compose BOM version 2023.05.01. We also have a library Small Team Library, which is not on Compose BOM, that depends on the Central Compose Library.
The Small Team Library is part of Main…

bko
- 111
- 3
0
votes
0 answers
The navigation keys of the device vibrate when opening the Jetpack Compose Dropdown Menu
When the Dropdown Menu is opened, there is a flicker in the navigation keys. When I create a new application with the same codes, there is no problem, but this flicker occurs in my current application.
While there is no problem in the activities I…

Yavo
- 43
- 5
0
votes
1 answer
Jetpack compose text field cleared when non-compose state is read
I have a Jetpack compose form, created from this tutorial. It shows errors nicely by validating the form when you click the submit button. I want the button on my form to be dynamically enabled, using the same form state.
The issue is that…

Daniel Wilson
- 18,838
- 12
- 85
- 135
0
votes
0 answers
Android Compose on button click go to sleep (turn screen off)
Like title said how to on click button to go system sleep, to turn off screen?
got this kotlin code:
@Composable
fun ButtonOnClickGoToSystemSleep() {
// Fetching the Local Context
val localContext = LocalContext.current
Button(onClick =…

acakojic
- 306
- 2
- 11
0
votes
1 answer
Change the ripple of the IconButton
how I can fix this
@Composable
fun Body() {
val scrollState = rememberScrollState()
Column(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(10.dp),
modifier =…

Unknown
- 187
- 7
0
votes
1 answer
setting button background color bug?
I've tried to set the background color of buttons with custom hex values:
colors.xml:
#F67070
#00B2FF
Button(
onClick = {}
colors = ButtonDefaults.buttonColors(
…

JustSightseeing
- 1,460
- 3
- 17
- 37