Skip to content
A simple Android library that applies shadows of any color to views and allows easy manipulation of edges.
Java
Branch: master
Clone or download
Latest commit 649975d Jul 24, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea Initial commit Jul 23, 2019
ComplexView Example Initial commit Jul 23, 2019
ComplexView Initial commit Jul 23, 2019
gradle/wrapper
screenshots added Jul 23, 2019
.gitignore Initial commit Jul 23, 2019
README.md Update README.md Jul 24, 2019
build.gradle Initial commit Jul 23, 2019
gradle.properties Initial commit Jul 23, 2019
gradlew Initial commit Jul 23, 2019
gradlew.bat Initial commit Jul 23, 2019
settings.gradle Initial commit Jul 23, 2019

README.md

ComplexView

Android Arsenal

A simple Android library that applies shadows of any color to views and allows easy manipulation of edges.





Alt text

Gradle setup

repositories{
    maven { url 'https://jitpack.io' }
}

dependencies{

implementation 'com.github.BluRe-CN:ComplexView:v1.0'
    
}

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

Alt text

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

        //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);

        //Create holder for TextView
        ComplexView tvHolder = new ComplexView(this);
        ComplexView.LayoutParams tvHolderParam = new ComplexView.LayoutParams(ComplexView.LayoutParams.MATCH_PARENT,       ComplexView.LayoutParams.MATCH_PARENT);
        tvHolder.setRadius(50);
        tvHolderParam.addRule(CENTER_IN_PARENT);
        tvHolder.setColor(Color.parseColor("#fdfcfc"));
        tvHolder.setLayoutParams(tvHolderParam);

        //Create TextView object
        TextView tv = new TextView(this);
        ComplexView.LayoutParams tvParam = new ComplexView.LayoutParams(ComplexView.LayoutParams.WRAP_CONTENT, ComplexView.LayoutParams.WRAP_CONTENT);
        tvParam.addRule(CENTER_IN_PARENT);
        tvParam.setMargins(5, 5, 5, 5);
        tv.setLayoutParams(tvParam);
        tv.setText("Shadow");
        
        //Couple up
        tvHolder.addView(tv);
        shadow.addView(tvHolder);
        YourMainView.addView(shadow);
You can’t perform that action at this time.