https://github.com/sephiroth74/material_drawable
Provides material background drawables to views
https://github.com/sephiroth74/material_drawable
Last synced: 3 months ago
JSON representation
Provides material background drawables to views
- Host: GitHub
- URL: https://github.com/sephiroth74/material_drawable
- Owner: sephiroth74
- License: mit
- Created: 2019-08-17T17:10:25.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-09T14:41:09.000Z (over 1 year ago)
- Last Synced: 2025-04-23T16:11:29.503Z (9 months ago)
- Language: Kotlin
- Size: 204 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Material Drawable
Provides material background drawables to views
[](https://jitpack.io/#sephiroth74/material_drawable)
# Installation
Top level **build.gradle** file:
buildscript {
...
}
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
The, inside your module **build.gradle** file:
dependencies {
...
implementation 'com.github.sephiroth74:material_drawable:**version**'
}
# Usage
val view1 = findViewById(R.id.testView1)
view1.background = MaterialBackgroundDrawable.Builder(MaterialShape.Type.ALL) {
focused(MaterialShapeDrawable.Style {
color(Color.YELLOW)
})
pressed(MaterialShapeDrawable.Style {
color(Color.GREEN)
})
normal(MaterialShapeDrawable.Style {
color(Color.BLACK)
strokeWidth(2f)
style(Paint.Style.STROKE)
})
}.build()
view1.setOnClickListener { Log.v("test", "onclick") }