CircleView

Additional

Language
Kotlin
Version
N/A
Created
May 27, 2019
Updated
Jun 9, 2019
Owner
Lopez Mikhael (lopspower)
Contributor
Lopez Mikhael (lopspower)
1
Activity
Badge
Generate
Download
Source code
APK file

Advertising

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.

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.1.1'

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

ℹ️ You can also use android:elevation instead of app:cv_shadow to have default Material Design elevation.

KOTLIN

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);

LICENCE

CircleView by Lopez Mikhael is licensed under a Apache License 2.0.