RoundedImageView

Additional

Language
Kotlin
Version
0.7.1 (Feb 25, 2019)
Created
Feb 21, 2019
Updated
Mar 5, 2019
Owner
Rishabh Harit (rishabh876)
Contributor
Rishabh Harit (rishabh876)
1
Activity
Badge
Generate
Download
Source code
APK file

Advertisement

RoundedImageView

A RoundedImageView library that supports rounding any corner or circular shape. It supports all kinds of drawable, bitmaps, resources just like a normal ImageView. All scale types are working. RoundedImageView is extended from AppCompatImageView.

Limitations

  • Android Studio does not display rounded corner in Layout Preview
  • Borders are not supported at the moment. Pull requests are welcomed.
  • Shadows are not supported at the moment.
  • RTL support is not present.
  • Oval shape is not supported.

Gradle

implementation 'com.rishabhharit.roundedimageview:RoundedImageView:0.7.1'

How to use

 <com.rishabhharit.roundedimageview.RoundedImageView
    ...
    app:cornerRadius="8dp"
    app:roundedCorners="topRight|bottomLeft"
    ...
 /> 

Circular Shape

To get Circular shape, all you need to do is set cornerRadius to a value that is higher than the width & height of your RoundedImageView app:cornerRadius="1000dp"

Customizations

app:roundedCorners is pretty flexible. It supports all the following variations

app:roundedCorners="all|top|bottom|right|topLeft|topRight|bottomLeft|bottomRight" (yes you can use multiple at the same time here separated by | )

Default is value for app:roundedCorners is all

Default is value for app:cornerRadius is 0dp