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 =…
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) }
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?!
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…
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…
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 =…
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…
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…
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 =…
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…
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…
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…
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 =…
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 =…
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( …
1
2