From 8243b9a7cb2378f70de3711d91f8d7254d32c77d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=94=E7=A2=97=E9=A5=AD?= Date: Mon, 22 Jul 2019 00:00:44 +0800 Subject: [PATCH] =?UTF-8?q?[=20+]=20ShadowDrawable=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=96=B9=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 | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/README_ShadowDrawable.md b/README_ShadowDrawable.md index c893709..860a974 100644 --- a/README_ShadowDrawable.md +++ b/README_ShadowDrawable.md @@ -1,14 +1,15 @@ # ShadowDrawable ## 效果预览 + -| [ShadowDrawable] | -| ------------------------------- | -| [][ShadowDrawable] | | +## 主要文件 +| 名字 | 摘要 | +| ---------------- | -------------- | +|ShadowDrawable | 阴影Drawable | - -## 基本用法 -#### 1.java代码设置 +### 1. 基本用法 +#### 1.1 java代码设置 ```java ShadowAttribute attrs = new ShadowAttribute() .setShadowColor(getResources().getColor(R.color.valid_color)) @@ -18,12 +19,22 @@ ShadowAttribute attrs = new ShadowAttribute() ShadowDrawableUtils.setBackground(view, attrs); ``` - -## 注意事项 +### 2. 方法([Method]) +|name|format|description| +|:---:|:---:|:---:| +| setShadowColor | int | 阴影颜色 | +| setBackgroundColor | int | 背景颜色 | +| setRadius | int | 阴影半径(模糊半径) | +| setOffsetX | int | 阴影x偏移 | +| setOffsetY | int | 阴影y偏移 | +| setOvalX | float | 椭圆X轴半径 | +| setOvalY |float | 椭圆y轴半径 | +| setShadowTypes |@ShadowType int[] | 阴影显示的位置 | + +### 3. 注意事项 1. 由于 setShadowLayer只有文字绘制阴影支持硬件加速,其它都不支持硬件加速, 故这里要关闭硬件加速 2. 由于ALPHA_8只记录颜色的alpha值, 故使用xml颜色值时当阴影颜色时需要加上alpha, 否则无效 3. 模糊半径为0是看不到阴影效果的 - -[ShadowDrawable]:https://github.com/yangsanning/MultiDrawable/blob/master/README_ShadowDrawable.md +[Method]:https://github.com/yangsanning/MultiDrawable/blob/master/drawable/src/main/java/ysn/com/drawable/shadow/ShadowAttribute.java