CircleView

This is an Android project allowing to realize a circular View in the simplest way possible. Finish the oval shapes of all colors in your projects.

Android app on Google Play

preview--2-

USAGE

To make a circular View add CircleView in your layout XML and add CircleView library in your project or you can also grab it via Gradle:

implementation 'com.mikhaellopez:circleview:1.0.3'

XML

<com.mikhaellopez.circleview.CircleView
    android:id="@+id/circleView"
    android:layout_width="300dp"
    android:layout_height="300dp"
    app:cv_border="true"
    app:cv_border_color="#000000"
    app:cv_border_width="8dp"
    app:cv_color="#3f51b5"
    app:cv_shadow="true"
    app:cv_shadow_color="#3f51b5"
    app:cv_shadow_radius="10" />

You must use the following properties in your XML to change your CircleView.

Properties:
  • app:cv_color (color) -> default WHITE
  • app:cv_border (boolean) -> default false
  • app:cv_border_width (dimension) -> default 4dp
  • app:cv_border_color (color) -> default BLACK
  • app:cv_shadow (boolean) -> default false
  • app:cv_shadow_color (color) -> default BLACK
  • app:cv_shadow_radius (float) -> default 8.0f
  • app:cv_shadow_gravity (center, top, bottom, start or end) -> default bottom

KOTLIN

capture

val circleView = findViewById<CircleView>(R.id.circleView)
circleView.circleColor = Color.WHITE
// Set Border
circleView.borderColor = Color.BLACK
circleView.borderWidth = 10f
// Add Shadow with default param
circleView.shadowEnable = true
// or with custom param
circleView.shadowRadius = 15f
circleView.shadowColor = Color.RED
circleView.shadowGravity = CircleView.ShadowGravity.CENTER

JAVA

CircleView circleView = findViewById(R.id.circleView);
circleView.setCircleColor(Color.WHITE);
// Set Border
circleView.setBorderColor(Color.BLACK);
circleView.setBorderWidth(10f);
// Add Shadow with default param
circleView.setShadowEnable(true);
// or with custom param
circleView.setShadowRadius(15f);
circleView.setShadowColor(Color.RED);
circleView.setShadowGravity(CircleView.ShadowGravity.CENTER);

GitHub