Hi all, I have a composable function as above . My...
# android
b
Hi all, I have a composable function as above . My idea is to align image to right of Row with some padding on all sides of Image. I also have to create border around image , which I did using border modifier. The problem I'm facing is when I set border to Image , the padding is lost which means I don't see padding for Image. Image touch right end of the screen. Is there a way we can have padding for border as well. #compose #android #kotlin
🧵 2
c
The order of the modifiers matters. Change the order of
padding
and
border
.
b
sure. Let me try
I tried to change the order. Its fine now. But the left and right borders touches the image. Is there a way can we add padding in border.
I tried like below and I'm able to achieve desired output:
Copy code
Image(
    painter = painterResource(id = R.drawable.cgux_ic_keyboard_16),
    modifier = Modifier
        .width(36.dp)
        .height(36.dp)
        .padding( 5.dp)
        .border(BorderStroke(1.dp, colorResource(id = R.color.cgux_primary_500_base)))
        .padding(5.dp)
        .clickable {},
    contentDescription = "Expandable Image",
    colorFilter = ColorFilter.tint( colorResource(id = R.color.cgux_primary_500_base))
)
Thanks for your support
👍 1