by lijiankun24

lijiankun24 / 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:



Read this in other languages: 中文English 


The result of using

is as follows:

By using

, 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


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



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(; slOval.setShadowColor(ContextCompat.getColor(this, R.color.drak_yellow))

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

// change the radius of shadow ShadowLayout slRadius = findViewById(; 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]


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

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.