当前位置: 首页 > news >正文

android 图片背景毛玻璃效果实现

图片背景毛玻璃效果实现

1 依赖
// Glide
implementation("com.github.bumptech.glide:glide:4.16.0")
kapt("com.github.bumptech.glide:compiler:4.16.0")  
implementation("jp.wasabeef:glide-transformations:4.3.0")
2 布局<com.google.android.material.card.MaterialCardViewxmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"android:id="@+id/cardView"android:layout_width="match_parent"android:layout_height="match_parent"android:clipChildren="true"app:cardElevation="0dp"app:cardBackgroundColor="@color/transparent"app:cardPreventCornerOverlap="true"app:strokeWidth="0dp"><!-- 毛玻璃模糊背景 View --><ImageViewandroid:id="@+id/blurBackground"android:layout_width="match_parent"android:layout_height="match_parent"android:adjustViewBounds="true"android:background="@color/ui_background"android:scaleType="centerCrop" />//...内容布局	
<com.google.android.material.card.MaterialCardView/>3 MainActivity代码                 Glide.with(this@MainActivity)
//                        .load(R.drawable.screen)
//                        .diskCacheStrategy(DiskCacheStrategy.ALL) // 显式声明使用缓存策略
//                        .transform(
//                            BlurTransformation(25, 8),
//                            ColorFilterTransformation(Color.argb(120, 0, 0, 0))  // 直接在毛玻璃效果上加深色遮罩
//                        )
//                        .into(binding.blurBackground)

相关文章:

  • SpringBoot中解决跨域问题
  • 74道TypeScript高频题整理(附答案背诵版)
  • 20250528-C#知识:强制类型转换
  • Vue2+Vuex通过数组动态生成store数据(扁平模式)
  • AMBA-AHB的地址译码
  • 在线临床指标分类信息表转甜甜圈矩阵图
  • 使用dig查看dns递归查询过程
  • 操作系统 | 第一章:操作系统引论思维导图
  • 【CAPL实战】LIN校验和测试
  • 模型微调参数入门:核心概念与全局视角
  • Step9—Ambari Web UI 初始化安装 (Ambari3.0.0)
  • Proguard代码混淆-springboot3
  • spring4第3课-ioc控制反转-详解依赖注入的4种方式
  • SpringBoot项目快速打包与部署,War包⽅式打包部署与Jar包⽅式打包部署两种方式
  • 基于Vue3.0的【Vis.js】库基本使用教程(002):图片知识图谱的基本构建和设置
  • SpringBoot Controller接收参数方式
  • SpringBoot使用ffmpeg实现视频压缩
  • vue+elementUi+axios实现分页(MyBatis、Servlet)
  • Baklib内容中台驱动资源高效整合
  • matlab中绘图函数plot
  • 测速网站怎么做/专业软文平台
  • 做网站工作怀孕/网络科技公司骗了我36800
  • 家里电脑如何做网站/企业整站优化
  • 成都建站程序/宁波网络营销公司
  • 开通网站费用怎么做分录/东莞seo优化推广
  • 郑州做网站便宜/关键词优化快速排名