Android 10.0 Launcher3单层高斯模糊(毛玻璃)效果的实现
1.概述
在10.0进行系统Laucher3定制中,有功能需求要求实现高斯模糊(毛玻璃)效果背景效果,在Launcher3中也是常见的功能这就需要了解Workspace的背景定义,然后对背景实现高斯模糊功能,首选要分析加载流程,然后对其背景进行高斯模糊就可以了
效果图如图:
2. Launcher3单层高斯模糊(毛玻璃)效果的实现的核心代码
packages\apps\Launcher3\res\layout\launcher.xml
packages\apps\Launcher3\src\com\android\launcher3\Launcher.java
packages\apps\Launcher3\src\com\android\launcher3\views\BlurUtil.java
3. Launcher3单层高斯模糊(毛玻璃)效果的实现代码功能分析
3.1 增加自定义高斯模糊类BlurUtil.java
package com.android.launcher3.views;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.graphics.drawable.BitmapDrawable;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.Re