-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
99dc89c
commit 58cf9d3
Showing
1 changed file
with
25 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,29 @@ | ||
# ShadowDrawable | ||
|
||
#### 使用说明 | ||
## 效果预览 | ||
|
||
| [ShadowDrawable] | | ||
| ------------------------------- | | ||
| [<img src="images/image1.png" height="512"/>][ShadowDrawable] | | | ||
|
||
|
||
## 基本用法 | ||
#### 1.java代码设置 | ||
```java | ||
ShadowAttribute attrs = new ShadowAttribute() | ||
.setShadowColor(getResources().getColor(R.color.valid_color)) | ||
.setRadius(20) | ||
.setBackgroundColor(Color.TRANSPARENT) | ||
.setShadowType(ShadowType.LEFT, ShadowType.TOP, ShadowType.RIGHT); | ||
ShadowDrawableUtils.setBackground(view, attrs); | ||
``` | ||
|
||
|
||
## 注意事项 | ||
1. 由于 setShadowLayer只有文字绘制阴影支持硬件加速,其它都不支持硬件加速, 故这里要关闭硬件加速 | ||
2. 由于ALPHA_8只记录颜色的alpha值, 故使用xml颜色值时当阴影颜色时需要加上alpha, 否则无效 | ||
3. 模糊半径为0是看不到阴影效果的 | ||
3. 模糊半径为0是看不到阴影效果的 | ||
|
||
|
||
|
||
[ShadowDrawable]:https://github.com/yangsanning/MultiDrawable/blob/master/README_ShadowDrawable.md |