https://github.com/tiiime/android-drawable-dsl
Declare Android shape drawable with dsl && dynamic.
https://github.com/tiiime/android-drawable-dsl
android drawable dsl kotlin
Last synced: about 2 months ago
JSON representation
Declare Android shape drawable with dsl && dynamic.
- Host: GitHub
- URL: https://github.com/tiiime/android-drawable-dsl
- Owner: tiiime
- Created: 2020-07-18T10:04:55.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-12-12T03:37:36.000Z (over 4 years ago)
- Last Synced: 2025-04-04T09:14:19.977Z (about 1 year ago)
- Topics: android, drawable, dsl, kotlin
- Language: Kotlin
- Homepage:
- Size: 1.92 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Android Drawable Dsl
[](https://jitpack.io/#tiiime/android-drawable-dsl)  
## Example
### shape
```kotlin
private fun createShapeDrawable() = shape(shape = GradientDrawable.RECTANGLE) {
corners(
corner = 20F,
cornerBottomLeft = 80F
)
gradient(
startColor = Color.RED,
endColor = Color.WHITE
)
stroke(
color = Color.BLACK,
width = 10
)
}
```

### layer-list
```kotlin
private fun createLayerList() = layerList(
item {
shape = shape {
corners(
cornerTopRight = 80F,
cornerBottomLeft = 80F
)
gradient(
startColor = Color.RED,
centerColor = Color.GREEN,
endColor = Color.BLUE
)
}
},
item(
left = 30,
top = 30,
right = 30,
bottom = 30
) {
shape = shape {
color = Color.WHITE
corners(80F)
}
}
)
```

### more

## Install
```groovy
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
```
[](https://jitpack.io/#tiiime/android-drawable-dsl)
```groovy
compile "com.github.tiiime:android-drawable-dsl:0.2.0"
```