Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yuanwenbing/SelectorDrawable
https://github.com/yuanwenbing/SelectorDrawable
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/yuanwenbing/SelectorDrawable
- Owner: yuanwenbing
- License: apache-2.0
- Created: 2016-11-28T11:15:26.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2016-12-07T03:11:00.000Z (almost 8 years ago)
- Last Synced: 2024-06-16T03:31:47.246Z (5 months ago)
- Language: Java
- Size: 3.21 MB
- Stars: 39
- Watchers: 3
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-android-ui - SelectorDrawable - 为按钮设置selector (Drawable)
README
# Description
主要用来为按钮设置selector,正常使用xml,不够灵活,而且代码量大,使用起来比较麻烦,定义这个类,使用Builder模式,使用起来比较灵活,可以设置圆角、描边,按下颜色,禁用颜色,选中颜色等,而且不需要太多的代码。
# Captures
![][image-1]# Use
## Gradle
compile 'com.yuan.library.selector:selectordrawable-release:1.0.3'
## Maven
~com.yuan.library.selector
selectordrawable-release
1.0.3
pom
# Example
// 使用颜色
SelectorFactory.create(new SelectorShape.SelectorBuilder()
.normalColor() // 正常颜色
.pressColor() // 按下颜色
.disableColor() // 禁用颜色
.selectColor() // 选择颜色
.shapeBuilder(new Shape.ShapeBuilder()
.corner() // 全部圆角
.leftTopCorner() // 左上圆角
.leftBottomCorner() // 左下圆角
.rightTopCorner() //右上圆角
.rightBottomCorner() // 右下圆角
.strokeColor() // 描边颜色
.strokeWidth()).build()) // 描边size
// 使用按钮
SelectorFactory.create(new SelectorDrawable.SelectorBuilder()
.normalDrawable()
.pressDrawable()
.disableDrawable()
.selectDrawable().build())# About me
- Mail:[[email protected]][1]
- QQ:11026979[1]: mailto:[email protected]
[image-1]: https://raw.githubusercontent.com/yuanwenbing/SelectorDrawable/master/captures/demo.gif