Easy to use, lightweight custom image view with rounded corners.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
This library allows you to create ImageViews with soft edges that are pleasing to the eye.
To make this view running on your app follow these simple steps.
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.mmmelik:RoundedImageView:v1.0.1'
}
RoundedImageView
extends ImageView
so all functions of ImageView
are available for RoundedImageView
.
RoundedImageView roundedImageView=findViewById(R.id.roundedImageView);
roundedImageView.setRadius(5); //Sets radius of all corners
roundedImageView.setRadius(RoundedImageView.Corner.BOTTOM_LEFT,50); //Override BOTTOM_LEFT corner.
roundedImageView.setImageDrawable(getResources().getDrawable(R.drawable.free)); //First set radius then set drawable.
<com.appbroker.roundedimageview.RoundedImageView
android:id="@+id/roundedImageView"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:src="@drawable/free"
app:radius="50dp"/>
<com.appbroker.roundedimageview.RoundedImageView
android:id="@+id/roundedImageView2"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:src="@drawable/free"
app:topLeftRadius="10dp"
app:topRightRadius="20dp"
app:bottomRightRadius="30dp"
app:bottomLeftRadius="40dp"/>
<com.appbroker.roundedimageview.RoundedImageView
android:id="@+id/roundedImageView3"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:src="@drawable/free"
app:radius="50dp"
app:bottomRightRadius="0dp"/>
In RoundedImageView
XML attribute android:adjustViewBounds
set to true by default. If it cause unintended behaviour of the view override with android:adjustViewBounds="false"
.
RoundedImageView
does not manipulate drawable of the view. Only clips out the corners of the view. So make sure you have fully wrapped drawable with the views borders.
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Branch
- Commit your Changes
- Push to the Branch
- Open a Pull Request