https://github.com/lopspower/circleview
Create circular view in android (change color, border & shadow) ⚫
https://github.com/lopspower/circleview
android circleview customview java kotlin
Last synced: 10 months ago
JSON representation
Create circular view in android (change color, border & shadow) ⚫
- Host: GitHub
- URL: https://github.com/lopspower/circleview
- Owner: lopspower
- License: apache-2.0
- Created: 2019-05-27T11:57:59.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-08-23T07:45:18.000Z (over 3 years ago)
- Last Synced: 2025-03-31T14:14:24.505Z (10 months ago)
- Topics: android, circleview, customview, java, kotlin
- Language: Kotlin
- Homepage:
- Size: 1.34 MB
- Stars: 165
- Watchers: 4
- Forks: 20
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
CircleView
=================

[](http://developer.android.com/index.html)
[](https://android-arsenal.com/api?level=14)
[](https://search.maven.org/artifact/com.mikhaellopez/circleview)
[](http://twitter.com/lopezmikhael)
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:
```groovy
implementation 'com.mikhaellopez:circleview:1.4.1'
```
XML
-----
```xml
```
You must use the following properties in your XML to change your CircleView.
| Properties | Type | Default |
| ------------------------------- | ------------------------------------------------------------ | --------------- |
| `app:cv_color` | color | WHITE |
| `app:cv_color_start` | color | cv_color |
| `app:cv_color_end` | color | cv_color |
| `app:cv_color_direction` | left_to_right, right_to_left, top_to_bottom or bottom_to_top | left_to_right |
| `app:cv_border` | boolean | false |
| `app:cv_border_width` | dimension | 4dp |
| `app:cv_border_color` | color | BLACK |
| `app:cv_border_color_start` | color | cv_border_color |
| `app:cv_border_color_end` | color | cv_border_color |
| `app:cv_border_color_direction` | left_to_right, right_to_left, top_to_bottom or bottom_to_top | left_to_right |
| `app:cv_shadow` | boolean | false |
| `app:cv_shadow_color` | color | BLACK |
| `app:cv_shadow_radius` | float | 8.0f |
| `app:cv_shadow_gravity` | center, top, bottom, start or end | bottom |
:information_source: You can also use `android:elevation` instead of `app:cv_shadow` to have default Material Design elevation.
KOTLIN
-----

```kotlin
val circleView = findViewById(R.id.circleView)
circleView.apply {
// Set Color
circleColor = Color.WHITE
// or with gradient
circleColorStart = Color.BLACK
circleColorEnd = Color.RED
circleColorDirection = CircleView.GradientDirection.TOP_TO_BOTTOM
// Set Border
borderWidth = 10f
borderColor = Color.BLACK
// or with gradient
borderColorStart = Color.BLACK
borderColorEnd = Color.RED
borderColorDirection = CircleView.GradientDirection.TOP_TO_BOTTOM
// Add Shadow with default param
shadowEnable = true
// or with custom param
shadowRadius = 15f
shadowColor = Color.RED
shadowGravity = CircleView.ShadowGravity.CENTER
}
```
JAVA
-----
```java
CircleView circleView = findViewById(R.id.circleView);
// Set Color
circleView.setCircleColor(Color.WHITE);
// or with gradient
circleView.setCircleColorStart(Color.BLACK);
circleView.setCircleColorEnd(Color.RED);
circleView.setCircleColorDirection(CircleView.GradientDirection.TOP_TO_BOTTOM);
// Set Border
circleView.setBorderWidth(10f);
circleView.setBorderColor(Color.BLACK);
// or with gradient
circleView.setBorderColorStart(Color.BLACK);
circleView.setBorderColorEnd(Color.RED);
circleView.setBorderColorDirection(CircleView.GradientDirection.TOP_TO_BOTTOM);
// Add Shadow with default param
circleView.setShadowEnable(true);
// or with custom param
circleView.setShadowRadius(15f);
circleView.setShadowColor(Color.RED);
circleView.setShadowGravity(CircleView.ShadowGravity.CENTER);
```
SUPPORT ❤️
-----
Find this library useful? Support it by joining [**stargazers**](https://github.com/lopspower/CircleView/stargazers) for this repository ⭐️
And [**follow me**](https://github.com/lopspower?tab=followers) for my next creations 👍
LICENCE
-----
CircleView by [Lopez Mikhael](http://mikhaellopez.com/) is licensed under a [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).