Mobile Development 19 min read

Implementing View‑Level Background Blur on Android: Open‑Source Solutions and Custom Approaches

This article examines the challenges of achieving view‑level background blur on Android, compares four implementation strategies—including open‑source libraries and custom AOSP modifications—analyzes their performance, compatibility, and visual quality, and provides code examples and practical recommendations for developers.

Coolpad Technology Team
Coolpad Technology Team
Coolpad Technology Team
Implementing View‑Level Background Blur on Android: Open‑Source Solutions and Custom Approaches

In Android development, designers often request a frosted‑glass (background blur) effect that iOS and web platforms provide natively via UIVisualEffectView , backdrop‑filter , or Flutter's BackdropFilter . Android historically lacked a built‑in view‑level blur, offering only window‑level blur support starting with Android 12.

The article distinguishes two blur scenarios: Window‑level blur (e.g., notification shade) and View‑level blur (blur within a single app screen). It focuses on the latter and surveys four solution families.

Open‑source solutions (方案一)

Popular libraries such as 500px/500px-android-blur , Dimezis/BlurView , and mmin18/RealtimeBlurView share a common approach: manually specify the background view and draw it onto an off‑screen Canvas during onDraw . Example:

blurringView.setBlurredView(blurredView);

These frameworks render the target view into a bitmap, apply a RenderScript blur, and draw the result, but they cannot use hardware bitmaps and incur extra off‑screen rendering overhead.

GL Functor approach (方案二)

Libraries like HokoFly/HokoBlurDrawable embed a hidden native method RecordingCanvas.callDrawGLFunction2() to link an OpenGL functor into the render pipeline. The functor captures the current screen via glCopyTexSubImage2D , applies a blur filter, and composites the result. This method avoids manual view selection but relies on hidden APIs that were removed in Android 12, making it fragile.

Canvas.saveLayer() extension (方案三)

By overloading Canvas.saveLayer() to accept a backdropFilter argument, developers can attach a SkImageFilter (e.g., SkBlurImageFilter ) to the layer. The blur is performed during the layer’s composition, offering simple usage:

final BlurDrawable blurDrawable = new BlurDrawable();
view.setBackgroundDrawable(blurDrawable);

This approach supports clipping and saturation effects but fails when the view’s alpha changes, because the layer cannot capture background content under those conditions.

Custom AOSP modification (方案四)

The most powerful solution modifies the Android framework itself. A new BackdropFilterDrawable is inserted before RenderNodeDrawable in the render pipeline, captures the full canvas snapshot, applies a SkImageFilter , and draws the filtered image. This method delivers high visual fidelity, supports alpha, clipping, scaling, and additional effects (e.g., saturation), while requiring source‑code changes and a custom build.

Comparison and performance

A benchmark on a Coolpad COOLOS 20s 5G device shows that the custom AOSP approach (方案四) offers the best overall balance of compatibility, visual quality, and low overhead, with doFrame overhead of +0.047 ms and RenderThread overhead of +1.579 ms compared to the baseline. Open‑source libraries (方案一) have the highest cost, while the GL Functor method (方案二) suffers from Android 12 incompatibility.

Conclusion

For projects requiring robust view‑level blur on Android, the custom AOSP modification (方案四) is recommended despite the need to maintain a patched platform. Open‑source libraries remain viable for quick prototypes on older Android versions, while the Canvas.saveLayer() extension offers a middle ground for simple use‑cases.

performancegraphicsAndroidopen sourceSkiaView Blur
Coolpad Technology Team
Written by

Coolpad Technology Team

Committed to advancing technology and supporting innovators. The Coolpad Technology Team regularly shares forward‑looking insights, product updates, and tech news. Tech experts are welcome to join; everyone is invited to follow us.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.