ClipDrawable 实现图片渐变现实
2024-08-28 12:53:54
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,图片可以完全显示。
最新文章
- 设计爬虫Hawk背后的故事
- 使用nodemailer发送邮件
- C# 字符串处理
- HDU4930 Fighting the Landlords 模拟
- 数据库的Instance/Crash Recovery
- 双击vbs时,默认cscript运行脚本
- SecureCRT远程控制ubuntu
- oracle手动启动服务
- git rev-list
- Spring MVC返回JSON数据
- ZOJ3228 - Searching the String(AC自动机)
- raw_input() 与 input()的区别
- BZOJ3394: [Usaco2009 Jan]Best Spot 最佳牧场
- 迁移到gitbook
- 简单的CSS网页布局--三列布局
- Jquery发送ajax请求以及datatype参数为text/JSON方式
- spring mvc ajax请求
- LeetCode -- Word Break 动态规划,详细理解
- 利用KindEditor实现公司通讯录的维护
- JavaScript保留关键字2。
热门文章
- cuda多线程间通信
- hdu-5491 The Next(贪心)
- 第15章 设备无关位图_15.1 DIB文件格式
- Thread对象的yield(),wait(),notify(),notifyall()
- IOS第四课——Autolayout_View
- $.data(data , ";";)
- sql将同一个表中的两列Int数据相加,有些数据是空的
- JavaScript String 对象
- 转- android硬件传感器
- Java数据类型和变量