本控件提取自QMUI,可以调整控件阴影的 深浅、面积、以及圆角
在Android 4.4及以下版本,阴影无效
先在 build.gradle 的 repositories 添加:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
再在dependencies添加:
dependencies {
// AndroidX
implementation 'com.github.limuyang2:LShadowLayout:1.0.6'
}
如果你使用 Android support,请使用以下添加:
dependencies {
implementation 'com.github.limuyang2:LShadowLayout:1.0.3'
}
本库中已包含的控件有:
ShadowLinearLayout
线性布局
ShadowRelativeLayout
相对布局
ShadowConstraintLayout
约束布局
ShadowFrameLayout
仅需替换项目中对应的布局即可。
例如:
<top.limuyang2.shadowlayoutlib.ShadowLinearLayout
…………
android:background="#fff"
android:padding="12dp"
app:l_radius="3dp" //圆角大小
app:l_shadowAlpha="0.2" //透明度
app:l_shadowElevation="5dp" //Z轴高度 >
</top.limuyang2.shadowlayoutlib.ShadowLinearLayout>
更多属性请查看源码
2018 limuyang
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.