ClipDrawable 实现图片渐变现实

 

clip.xml

<?xml version="1.0" encoding="utf-8"?>
<clip xmlns:andro />

 

<ImageView
android: />

 

Java代码

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

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

 

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

 

相关文章:

  • 2021-04-27
  • 2021-12-05
  • 2021-12-05
  • 2021-12-12
  • 2022-12-23
  • 2021-09-05
  • 2022-12-23
猜你喜欢
  • 2021-06-02
  • 2022-12-23
  • 2021-07-21
  • 2021-09-16
  • 2021-07-16
  • 2021-05-03
相关资源
相似解决方案