项目作者: wangjiegulu

项目描述 :
Shadow layout, shadow view for android.
高级语言: Java
项目地址: git://github.com/wangjiegulu/ShadowViewHelper.git
创建时间: 2015-05-25T07:48:21Z
项目社区:https://github.com/wangjiegulu/ShadowViewHelper

开源协议:Apache License 2.0

下载


ShadowViewHelper

Shadow layout, shadow view for android.

How to use:

It's very simple to use.

Gradle(Check newest version):

  1. compile 'com.github.wangjiegulu:ShadowViewHelper:x.x.x'

Maven(Check newest version):

  1. <dependency>
  2. <groupId>com.github.wangjiegulu</groupId>
  3. <artifactId>ShadowViewHelper</artifactId>
  4. <version>x.x.x</version>
  5. </dependency>

xml:

  1. <LinearLayout
  2. android:id="@+id/activity_main_shadow_view"
  3. android:layout_width="wrap_content"
  4. android:layout_height="wrap_content"
  5. >
  6. </LinearLayout>

Activity:

  1. // all side shadow
  2. ShadowProperty sp = new ShadowProperty()
  3. .setShadowColor(0x77000000)
  4. .setShadowDy(dip2px(this, 0.5f))
  5. .setShadowRadius(dip2px(this, 3))
  6. .setShadowSide(ShadowProperty.ALL);
  7. ShadowViewDrawable sd = new ShadowViewDrawable(sp, Color.WHITE, 0, 0);
  8. ViewCompat.setBackground(shadowViewA, sd);
  9. ViewCompat.setLayerType(shadowViewA, ViewCompat.LAYER_TYPE_SOFTWARE, null);
  10. // only all sides except top shadow
  11. ShadowProperty sp = new ShadowProperty()
  12. .setShadowColor(0x770000FF)
  13. .setShadowDy(dip2px(this, 0.5f))
  14. .setShadowRadius(dip2px(this, 3))
  15. .setShadowSide(ShadowProperty.LEFT | ShadowProperty.RIGHT | ShadowProperty.BOTTOM);
  16. ShadowViewDrawable sd = new ShadowViewDrawable(sp, Color.TRANSPARENT, 0, 0);
  17. ViewCompat.setBackground(shadowViewD, sd);
  18. ViewCompat.setLayerType(shadowViewD, ViewCompat.LAYER_TYPE_SOFTWARE, null);

License

  1. Copyright 2015 Wang Jie
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.

Android Arsenal