galex

    galex

    2 years ago
    Is there a way to tell an Image to be round?
    b

    Brett Best

    2 years ago
    Like rounded corners?
    galex

    galex

    2 years ago
    Yes! To make it a circle, basically
    b

    Brett Best

    2 years ago
    I think you achieve this using the modifier parameter
    Eric Ampire [MOD]

    Eric Ampire [MOD]

    2 years ago
    @Composable
    fun Picture(imageRes: Int) {
        val image = imageResource(id = imageRes)
        val pictureModifier = Modifier
                .padding(10.dp)
                .clip(androidx.ui.foundation.shape.corner.CircleShape)
                .preferredSize(200.dp)
    
        Image(
            asset = image,
            modifier = pictureModifier
        )
    }
    You have just to clip the image with the circle shape, like in this code
    galex

    galex

    2 years ago
    Thank you! I was wondering how the Modifier is called!