Android控件阴影库

Android控件阴影库

Gradle 添加依赖

//阴影支持
implementation 'com.lijiankun24:shadowlayout:1.0.0'

控件用法

<com.lijiankun24.shadowlayout.ShadowLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="30dp"
        app:shadowColor="#66000000"
        app:shadowDx="0dp"
        app:shadowDy="3dp"
        app:shadowRadius="10dp"
        app:shadowSide="all">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@android:color/white"
            android:contentDescription="@null"
            android:src="@mipmap/ic_launcher"/>
    </com.lijiankun24.shadowlayout.ShadowLayout>

效果图

属性含义

1. app:shadowColor="#66000000" 控制阴影的颜色,注意:颜色必须带有透明度的值

2. app:shadowDx="0dp" 控制阴影 x 轴的偏移量

3. app:shadowDy="3dp" 控制阴影 y 轴的偏移量

4. app:shadowRadius="10dp" 控制阴影的范围

5. app:shadowSide="all|left|right|top|bottom" 控制阴影显示的边界,共有五个值

原文地址:https://www.cnblogs.com/JQ04/p/13515788.html