A RoundedImageView that supports any corner rounding or circular shape
A RoundedImageView library that supports rounding any corner or circular shape. RoundedImageView is extended from AppCompatImageView.
implementation 'com.rishabhharit.roundedimageview:RoundedImageView:0.8.4'
<com.rishabhharit.roundedimageview.RoundedImageView
...
app:cornerRadius="8dp"
app:roundedCorners="topRight|bottomLeft"
...
/>
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"
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 |
) |
app:reverseMask="true/false"
This attribute can be used to achieve transparency inside the shape instead of outside the given shape. Padding area is also a part of outside region in this case.
Note: Shadows don;t work when reverseMask
is true
.
Default is value for app:roundedCorners
is all
Default is value for app:cornerRadius
is 0dp
Default is value for app:reverseMask
is false