Questions tagged [android-jetpack-compose-button]
30 questions
                    
                    71
                    
            votes
                
                8 answers
            
        background color on Button in Jetpack Compose
Button(backgroundColor = Color.Yellow) {
    Row {
        Image(asset = image)
        Spacer(4.dp)
        Text("Button")
    }
}
I can not figure out why I can't use background color on Button.
I followed the Compose Layout codelabs.
There is a…
         
    
    
        shotmeinthehead
        
- 779
- 1
- 4
- 10
                    25
                    
            votes
                
                4 answers
            
        Modify ripple color of IconButton in Jetpack Compose
How can I change the ripple color of an IconButton?
I tried doing it this way, but it doesn't change:
IconButton(
        onClick = { onClick() },
        modifier = Modifier.clickable(
          onClick = { onClick() },
          indication =…
         
    
    
        Praveen P.
        
- 976
- 2
- 11
- 23
                    24
                    
            votes
                
                1 answer
            
        How to create a circular Outlined button with jetpack compose
I am trying to create a circular OutlinedButton with an icon in the center without text.
    OutlinedButton(onClick = { /*TODO*/ },
        shape = CircleShape,
        border= BorderStroke(1.dp, Color.Blue)
    ) {
        Icon(Icons.Default.Add,…
         
    
    
        Gabriele Mariotti
        
- 320,139
- 94
- 887
- 841
                    20
                    
            votes
                
                2 answers
            
        How to remove or reduce padding in Jetpack compose OutlinedButton
Unable to reduce the huge padding in OutlinedButton. Tried contentPadding, modifier padding, etc. Cannot reduce padding for text "apple". Any idea? Should I use any other type of compose component for this?
OutlinedButton(     
    onClick = {},    …
         
    
    
        rysv
        
- 2,416
- 7
- 30
- 48
                    16
                    
            votes
                
                2 answers
            
        Transparent background in Outlined Button in Jetpack Compose
I want to create button where I have only text and icon and all background and borders are transparent. I create something like that:
OutlinedButton(
    colors = ButtonDefaults.buttonColors(backgroundColor = Color.Transparent),
    border =…
         
    
    
        edi233
        
- 3,511
- 13
- 56
- 97
                    15
                    
            votes
                
                3 answers
            
        How to Change Button Background color on click of the button
I am trying to change the button background color on click of that button in Android jetpack compose.
         
    
    
        SoftwareGuy
        
- 1,121
- 2
- 11
- 23
                    12
                    
            votes
                
                4 answers
            
        How to remove padding from Text button?
I am trying to remove padding from TextButton but it wont work.
TextButton(
    onClick = {},
    modifier = Modifier.padding(0.dp)
) {
    Text(
        " ${getString(R.string.terms_and_conditions)}",
        color = MaterialTheme.colors.primary,
 …
         
    
    
        BraveEvidence
        
- 53
- 11
- 45
- 119
                    11
                    
            votes
                
                2 answers
            
        How to animate width of a button in Jetpack Compose
Let's say I have a Composable like this :
@Composable
fun LoadingButton() {
    val (isLoading, setIsLoading) = state { false }
    Button(
        onClick = setIsLoading,
        text = {
            if (isLoading) {
                Text(text =…
         
    
    
        Kélian
        
- 3,323
- 3
- 11
- 20
                    9
                    
            votes
                
                5 answers
            
        JetPack Compose Button with drawable
How can we achieve this in jetpack compose
I'm doing something like this
Button(
    elevation = ButtonDefaults.elevation(
        defaultElevation = 0.dp,
        pressedElevation = 8.dp,
        disabledElevation = 0.dp
    ),
    onClick = {…
         
    
    
        Dheeraj Gupta
        
- 405
- 1
- 4
- 12
                    6
                    
            votes
                
                2 answers
            
        How to use weight in a Button to align Text on the left and Icon on the right
I'm building a re-usable Button component in Jetpack Compose, which is basically a Row. The button should have a text on the left end and an icon on the right end. This works straight forward like this:
@Composable
fun MyButton(
    text: String,
  …
         
    
    
        Day
        
- 844
- 1
- 9
- 21
                    6
                    
            votes
                
                4 answers
            
        How to align different elements inside a Button in Jetpack Compose?
I am trying to build the following component,
Following is my code,
Button(onClick = { /*TODO*/ }, modifier = Modifier.fillMaxWidth()) {
    Image(painter = painterResource(id = R.drawable.ic_check_circle) , contentDescription = "")
    Text(text =…
         
    
    
        nayan dhabarde
        
- 1,734
- 1
- 19
- 38
                    6
                    
            votes
                
                2 answers
            
        onPressIn and onPressOut in jetpack compose
I have button to record voice so I want it to start record when user press it and stop when he leave it
@Composable
fun Screen(){
   
   Button(){
      Text("record")
   }
}
         
    
    
        Omar Khaled
        
- 439
- 1
- 4
- 16
                    6
                    
            votes
                
                3 answers
            
        How to align icon in button to the left and keep text centered
I am trying to align the icon of a button to the left and keep the text centered. Any ideas how this can be achieved?
My composable:
  @Composable
  fun CustomButton() {
    MaterialTheme {
      OutlinedButton(
        onClick = {},
       …
         
    
    
        Praveen P.
        
- 976
- 2
- 11
- 23
                    5
                    
            votes
                
                1 answer
            
        Jetpack Compose: How to avoid Button Text disappearing when Button size is small?
I am trying to create a custom button that is small and can show a numerical value between 0 and 99 as Text. Depending on the fontsize the Text disappears from the Button when the size of the Button is set too low, even though there still is space.…
         
    
    
        bill
        
- 167
- 1
- 2
- 7
                    3
                    
            votes
                
                5 answers
            
        How to detect button release after button press in Android Jetpack Compose?
I find listeners for onClick and onLongClick and even onPress but there is no event/listener for something like buttonDown and buttonUp, or onPress and onRelease.
Am I missing something?  My current use case is that when a user presses a button I…
         
    
    
        user2297550
        
- 3,142
- 3
- 28
- 39