=================
This is an Android project allowing to realize a circular and slice ImageView in the simplest way possible. This library was developed and extended based on https://github.com/lopspower/CircularImageView
To make a circular ImageView add CircularImageView in your layout XML and add CircularImageView library in your project or you can also grab it via Gradle:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.hantrungkien:CircleSliceImageView:v1.0.0'
}
<com.kienht.csiv.CircleSliceImageView
android:id="@+id/circleSliceImageView"
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/logo" />
You must use the following properties in your XML to change your CircularImageView.
app:civ_border
(boolean) -> default trueapp:civ_border_color
(color) -> default WHITEapp:civ_border_width
(dimension) -> default 4dpapp:civ_background_color
(color) -> default WHITEapp:civ_shadow
(boolean) -> default falseapp:civ_shadow_color
(color) -> default BLACKapp:civ_shadow_radius
(float) -> default 8.0fapp:civ_shadow_gravity
(center, top, bottom, start or end) -> default bottom
CircularImageView circularImageView = (CircularImageView)findViewById(R.id.yourCircularImageView);
// Set Border
circularImageView.setBorderColor(getResources().getColor(R.color.GrayLight));
circularImageView.setBorderWidth(10);
// Add Shadow with default param
circularImageView.addShadow();
// or with custom param
circularImageView.setShadowRadius(15);
circularImageView.setShadowColor(Color.RED);
circularImageView.setBackgroundColor(Color.RED);
circularImageView.setShadowGravity(CircularImageView.ShadowGravity.CENTER);
- By default the ScaleType is CENTER_CROP. You can also used CENTER_INSIDE but the others one are not supported.
- Enabling adjustViewBounds is not supported as this requires an unsupported ScaleType.
A special thanks go to Mr. Igalata
CircularImageView by Lopez Mikhael is licensed under a Apache License 2.0.