How to create circular imageview with Jetpack compose?
Last updated Aug 08, 2021In this Jetpack compose tutorial we will learn how to create circular imageview in Android application.
Circular Image View is used in many of the apps. These types of images are generally used to represent the profile picture of the user and many more images.
Let's say I have a rectangular image like the one below, how can I force it to be drawn as a circle in Jetpack Compose?
Let's get started
Step 1: Create android application in android studio
Step 2: Follow step for setup Jetpack Compose with Android Studio
Step 3: let us display an Image with circular shape. Add Circular Image In MainActivity.kt.
There's a clip modifier which can be applied to any composable as well as the Image, just pass a CicularShape into it:
package com.example.jetpack
import android.os.Bundle class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { ) @Preview(showBackground = true) CircularImageViewDemo() } |
Image
Conclusion: In this compose tutorial we covered how to create a circular imageview in android studio.
Article Contributed By :
|
|
|
|
1413 Views |