基于Maven远程仓库的第一个控件(控件阴影效果)

xiaoxiao2021-02-28  115

请注明出处http://blog.csdn.net/qq_23179075/article/details/71244693


描述: 一个控件阴影效果,支持阴影大小和颜色设置,可以设置控件上下的阴影;

使用方式:在build.gradle中加入以下代码

compile 'com.zhengliang:shadow-view:1.0.1'

顶部阴影效果

底部阴影效果

使用方式xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:id="@+id/tv_test" android:layout_width="match_parent" android:layout_height="100dp" android:background="#FF4567" android:gravity="center" android:text="Hello World!" android:layout_centerInParent="true" /> <com.example.shadowviewlibrary.CustomShadowView android:id="@+id/shadow_view" android:layout_width="wrap_content" android:layout_height="wrap_content" app:shadow_color="@color/colorPrimary" app:shadow_fuzzy_radius="25" app:shadow_height="10dp" app:shadow_position="down" app:view_id="@id/tv_test" /> </RelativeLayout>

如果要给某个控件加这个阴影效果,必须将要加的控件和该控件放在在RelativeLayout中

xml自定义属性java代码功能shadow_colorsetShadow_color设置阴影颜色shadow_fuzzy_radiussetShadow_fuzzy_radius设置阴影模糊半径shadow_heightsetShadow_height设置阴影高度shadow_positionsetShadow_position设置阴影位置(up上、down下)view_id绑定需要设置阴影的控件

源码地址:https://github.com/azhengyongqin/shadow-view

转载请注明原文地址: https://www.6miu.com/read-41415.html

最新回复(0)