From 58cf9d38ea32958c139e9380e29710373ef9320a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=94=E7=A2=97=E9=A5=AD?= Date: Sun, 21 Jul 2019 23:49:46 +0800 Subject: [PATCH] =?UTF-8?q?[=20+]=20ShadowDrawable=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=94=A8=E6=B3=95=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README_ShadowDrawable.md | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/README_ShadowDrawable.md b/README_ShadowDrawable.md index d7ee68c..c893709 100644 --- a/README_ShadowDrawable.md +++ b/README_ShadowDrawable.md @@ -1,6 +1,29 @@ # ShadowDrawable -#### 使用说明 +## 效果预览 + +| [ShadowDrawable] | +| ------------------------------- | +| [][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是看不到阴影效果的 \ No newline at end of file +3. 模糊半径为0是看不到阴影效果的 + + + +[ShadowDrawable]:https://github.com/yangsanning/MultiDrawable/blob/master/README_ShadowDrawable.md