A simple Android library that applies shadows of any color to views and allows easy manipulation of edges.
Language:
Owner:
Contributors:
License:
Description:
ComplexView
\
\
\
\
\
\
Gradle setup
repositories{ maven { url 'https://jitpack.io' } } dependencies{ implementation 'com.github.BluRe-CN:ComplexView:v1.1' }
Maven setup
<repositories> <repository> <id>jitpack.io</id> <url>https://jitpack.io</url> </repository> </repositories> <dependency> <groupId>com.github.BluRe-CN</groupId> <artifactId>ComplexView</artifactId> <version>Tag</version> </dependency>
Usage
Xml
Code to achieve the above effect
<com.blure.complexview.ComplexView android:layout_width="100dp" android:layout_height="100dp" app:radius="50dp" app:shadow="true" app:shadowAlpha="100" app:shadowColor="#0061FF" app:shadowSpread="2"> <com.blure.complexview.ComplexView android:layout_width="match_parent" android:layout_height="match_parent" app:color="#fdfcfc" app:radius="50dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:layout_margin="5dp" android:text="Shadow" /> </com.blure.complexview.ComplexView> </com.blure.complexview.ComplexView>
Java
Code to achieve the above effect
java
//Initialize parent as a shadow
ComplexView shadow = new ComplexView(this);
ComplexView.LayoutParams param = new ComplexView.LayoutParams(convertDpToPixel(100), convertDpToPixel(100));
float[] radii = {50, 50, 50, 50, 50, 50, 50, 50};
shadow.setShadow(new Shadow(2, 100, "#0061FF", GradientDrawable.RECTANGLE, radii));
shadow.setLayoutParams(param);