原由

UI妹子那个IOS的手机,说要我做这个效果,一乍看,以为是设置透明度,做出来说需要的是毛玻璃效果,百度才知道。。。

资料

自从iOS系统引入了Blur效果,也就是所谓的毛玻璃、模糊化效果,磨砂效果,各大系统就开始竞相模仿
效果如图

效果我们知道了,如何在Android中实现呢,说白了就是对图片进行模糊化处理,这个对于我来说有点复杂,参阅:Android高级模糊技术

第三方–500px-android-blur

GitHub地址

1.导gradle

Define via Gradle:

repositories {maven { url 'https://github.com/500px/500px-android-blur/raw/master/releases/' }
}
dependencies {compile 'com.fivehundredpx:blurringview:1.0.0'
}

在我的项目中gradle报错了(我的AS使用的)

网上说是由于资源重复了,我的解决是修改了 minSdkVersion 和targetSdkVersion版本

项目中的
minSdkVersion 14
targetSdkVersion 21

改成如下的就解决了
minSdkVersion 15
targetSdkVersion 23

2.使用

xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"tools:context="com.zy.zengdemo.maoboli.MaoActivity"><ScrollView
        android:id="@+id/scroll_view"android:layout_width="match_parent"android:layout_height="match_parent"><LinearLayout
            android:id="@+id/layout"android:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical"><TextView
                android:layout_width="match_parent"android:layout_height="200dp" /><ImageView
                android:layout_width="wrap_content"android:layout_height="wrap_content"android:src="@mipmap/image_maoboli" /><TextView
                android:layout_width="match_parent"android:layout_height="300dp" /></LinearLayout></ScrollView><!-- Here, we customize the blurring view with values different from the defaults. --><com.fivehundredpx.android.blur.BlurringView
        android:id="@+id/blurring_view"android:layout_width="300dp"android:layout_height="300dp"android:layout_centerHorizontal="true"android:layout_centerVertical="true"app:blurRadius="20"app:downsampleFactor="6"app:overlayColor="#99FFFFFF" /></RelativeLayout>

activity

public class MaoActivity extends AppCompatActivity {BlurringView blurringView;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_mao);initView();}private void initView() {View view = findViewById(R.id.layout);//BlurringView控件blurringView = (BlurringView) findViewById(R.id.blurring_view);//需要模糊的viewblurringView.setBlurredView(view);}

到这个地方运行有报错,错误如下:

android.view.InflateException: Binary XML file line #39: Error inflating class com.fivehundredpx.android.blur.BlurringViewCaused by: android.view.InflateException: Binary XML file line #39: Error inflating class com.fivehundredpx.android.blur.BlurringViewCaused by: java.lang.reflect.InvocationTargetExceptionCaused by: java.lang.NoClassDefFoundError: android.support.v8.renderscript.RenderScript

连续引起的看最后,用到了android.support.v8.renderscript.RenderScript没有导入这个包

这里用23一下的(不包括23),不然又会报错,23在包里加了东西(可能资源冲突了)

运行继续报错和上面类似,但最后一句不同

Caused by: android.support.v8.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfiedLinkError: unknown failure

这是由于没有so文件,jar包的地方有so文件


到这里就成功了
效果图:

 后话

效果出来也不是特别明显,可能是参数设置的原因。而且最后项目中也没有使用,UI妹子说不好看。。。。。。

Android毛玻璃效果实现相关推荐

  1. Android毛玻璃效果的实现(本文系转载一种快速毛玻璃虚化效果实现)

    看到这篇文章感觉不错转载一下,且自己做了一个小demo:链接 在iOS设备上我们随处可见毛玻璃效果,而且最近越来越多的场合应用到了这种美观的虚化效果,包括本人的一个开源项目BlureImageView ...

  2. android毛玻璃效果,模糊视图工具类!类 高斯模糊

    android 模糊效果,简单的一个将已拥有的Bitmap(Drawable转为Bitmap即可)转为模糊视图,达到需求效果. 先来看看效果: 代码: /***create by Davide* * ...

  3. android毛玻璃效果,Android 中实现毛玻璃效果

    - 关于高斯模糊效果的实现 public class BitmapLoader { private Context mContext; public BitmapLoader(Context cont ...

  4. android 开源 高斯模糊_Android实现带毛玻璃效果(高斯模糊)背景的Dialog

    最近换了工作,由于工作中要使用一些自己以前不是很了解的知识,就没有时间更新博客了. 由于最近做了一些很有意思的小demo,不吐不快,再加上还是认为技术需要沉淀和梳理,所以再次把写博客这件事拾起来. 已 ...

  5. 毛玻璃效果在Android的实现

     本文已授权「玉刚说」微信公众号独家发布 毛玻璃效果实际上是对原图片的严重劣化,突出朦胧感,一般都是通过图片的缩放+模糊算法来实现,从性能角度考虑,模糊半径不能大于25,所以要更高的模糊效果则需要进行 ...

  6. android动态毛玻璃,Android模糊处理实现图片毛玻璃效果

    本文实例讲解了Android 虚化图片.模糊图片.图片毛玻璃效果的实现方法,具体内容如下 效果如图: 在Android可以用RenderScript方便的实现这个方法: private void bl ...

  7. android高仿微信聊天页面,Android 高仿微信语音聊天页面高斯模糊(毛玻璃效果)

    目前的应用市场上,使用毛玻璃效果的APP随处可见,比如用过微信语音聊天的人可以发现,语音聊天页面就使用了高斯模糊效果. 先看下效果图: 仔细观察上图,我们可以发现,背景图以用户头像为模板,对其进行了高 ...

  8. Android高斯模糊(毛玻璃效果)蒙层库

    ShapeBlurView ShapeBlurView库是一个高斯模糊(毛玻璃效果)蒙层库.Like iOS UIVisualEffectView 不知大家做需求的时候是否有这样的效果要求: 需求示例 ...

  9. android 仿ios毛玻璃,类 iOS 毛玻璃效果控件 BlurView

    软件介绍 BlurView 是Android下类似 iOS 毛玻璃效果控件. 使用: android:id="@+id/blurView" android:layout_width ...

最新文章

  1. Python使用tpot获取最优模型、将最优模型应用于交叉验证数据集(5折)获取数据集下的最优表现,并将每一折(fold)的预测结果、概率、属于哪一折与测试集标签、结果、概率一并整合输出为结果文件
  2. java线程 打印_Java多线程实战之交叉打印的两种方法
  3. C# 与 Unity 同名函数
  4. docker 容器保存为镜像_Docker容器和镜像操作
  5. IIS6文件权限不对触发了Windows身份认证问题解决方法
  6. 远控免杀专题(22)-SpookFlare免杀
  7. NodeJS学习第一季-路由规则
  8. Spring 各种注解(@)的含义与认识
  9. 微波网络中参考面移动对散射参量的影响
  10. linux下好用的截图工具,Linux系统下一款比较易用的截图工具
  11. 文件夹html文件批量替换,DirRplacer(文件批量替换工具)
  12. smartupload java_jspSmartUpload组件使用(一)
  13. android免费商用图标,(干货分享)免费可商用的图标库
  14. 法兰克机器人外部自动_(完整版)KUKA机器人外部自动配置方法
  15. PWM呼吸灯之三角波、锯齿波、正弦函数波
  16. 全球及中国大健康产业投资潜力与运营价值分析报告2022-2028年
  17. bootstrap--表格(table的各种样式)
  18. nested exception is org.apache.ibatis.binding.BindingException: Parameter 'xxxx'解决方案
  19. 2022最新200道软件测试面试题
  20. (zt)魔方玩法(图解)

热门文章

  1. 实验室预约管理系统(Java+SSH+Web+MySQL+ofbiz系统)
  2. 计算机基础知识制图,计算机绘图基础
  3. 简单图+Havel_Hakimi定理
  4. MIT JOS lab2内存管理实验记录
  5. 如何对长期出差的员工进行“人文关怀”,前提是差旅标准仍然很抠?
  6. 1.计算机图形学 实验 线条(利用C语言图形函数绘图)
  7. 杰理ac18芯片_杰理AC1074 MP3解码芯片ic方案说明
  8. 华为自带计算机怎么添加桌面,如何在华为手机的桌面上设置天气和时间
  9. 棋子的移动问题(递归问题)
  10. 王阳明心学:此心光明,夫复何言