首页 > 其他 > 详细

ClipDrawable 实现图片渐变现实

时间:2015-11-18 12:40:15      阅读:404      评论:0      收藏:0      [点我收藏+]

 

 

技术分享

 

clip.xml

<?xml version="1.0" encoding="utf-8"?>
<clip xmlns:android="http://schemas.android.com/apk/res/android"
android:clipOrientation="vertical"
android:drawable="@drawable/iii"
android:gravity="top" />

 

<ImageView
android:id="@+id/data"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/clip" />

 

Java代码

final ClipDrawable draw = (ClipDrawable) imageView.getBackground();

draw.setLevel(draw.getLevel() + 1000);

 

注意: 默认的Level值是0,表示图片被这个裁剪,故图片是不可见的。当值达到10000是代码裁剪为0,图片可以完全显示。

 

ClipDrawable 实现图片渐变现实

原文:http://www.cnblogs.com/lzh-Linux/p/4974038.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!