ShadowLayout

by lijiankun24

lijiankun24 / ShadowLayout

简单好用的阴影库-ShadowLayout

450 Stars 78 Forks Last release: Not found 28 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

ShadowLayout

Download

Read this in other languages: 中文English 

Intro

The result of using

ShadowLayout
is as follows:

By using

ShadowLayout
, you can set the color、shape、radius、display boundary (all|left|right|top|bottom), the offset of the x-axis and the y-axis of shadow.

You can change the color and radius of shadow dynamically, as follows:

How to use ShadowLayout

Setting up the dependency

Gradle:

groovy
    implementation 'com.lijiankun24:shadowlayout:x.y.z'

Maven:

groovy
    
      com.lijiankun24
      shadowlayout
      x.y.z
      pom
    

Please replace x and y and z with the latest version numbers:Download

Show Shadow

config in xml: ``` xml

    

The result of above xml is as follows:

There are 6 properties in xml:

  • app:shadowColor="#66000000" set the color of shadow,notice:Color must have a alpha value
  • app:shadowShape="rectangle|oval" set the shape of shadow:rectangle|oval
  • app:shadowDx="0dp" set the shadow x-axis offset
  • app:shadowDy="3dp" set the shadow y-axis offset
  • app:shadowRadius="10dp" set the radius of shadow
  • app:shadowSide="all|left|right|top|bottom" set the display boundary (all|left|right|top|bottom) of shadow

Change shadow dynamically

``` java // change the color of shadow ShadowLayout slOval = findViewById(R.id.sl_oval); slOval.setShadowColor(ContextCompat.getColor(this, R.color.drak_yellow))

// change the color of shadow ShadowLayout slRectangle = findViewById(R.id.sl_rectangle) slRectangle.setShadowColor(Color.parseColor("#EE00FF7F"));

// change the radius of shadow ShadowLayout slRadius = findViewById(R.id.sl_radius); slRadius.setShadowRadius(dip2px(12))

the result is as follows:

Welcome to star and fork, and welcome to download the ShadowLayoutExample.apk to experience. if any questions are welcome. My work email: [email protected]

License

Copyright 2018 lijiankun24

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.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.