Use this tag when the question is related to the `Switch` UI component in Android Jetpack Compose.
Questions tagged [jetpack-compose-switch]
3 questions
2
votes
2 answers
Disabled but clickable switch in jetpack compose
I have a disabled switch but I still want it to be clickable. I tried to add a clickable modifier but it still won't register the click when the switch itself is pressed
Switch(
modifier = Modifier
.clickable(
enabled =…

Tiberiu Paduraru
- 313
- 3
- 17
1
vote
1 answer
Android Compose - How to remove the space above and below the Switch
I have Row with two components, Text and Switch, after adding the Switch, I see the space above and below. I want the heigh of Switch is fit to UI height.
I use padding(0.dp) but it is not working.
How to remove that?
This is my code:
Row(
…

PhongBM
- 799
- 10
- 23
1
vote
0 answers
Disabled switch consumes click events in Jetpack Compose
I want an enabled switch to consume the click events and a disabled switch to pass the click event to its parent Composable.
Why does a disabled Switch consume click events?
A minified example of the issue,
@Composable
fun DisabledSwitch() {
…

Abhimanyu
- 11,351
- 7
- 51
- 121