Share via


Window.SetBackgroundBlurRadius(Int32) Method

Definition

Blurs the screen behind the window within the bounds of the window.

[Android.Runtime.Register("setBackgroundBlurRadius", "(I)V", "GetSetBackgroundBlurRadius_IHandler", ApiSince=31)]
public virtual void SetBackgroundBlurRadius (int blurRadius);
[<Android.Runtime.Register("setBackgroundBlurRadius", "(I)V", "GetSetBackgroundBlurRadius_IHandler", ApiSince=31)>]
abstract member SetBackgroundBlurRadius : int -> unit
override this.SetBackgroundBlurRadius : int -> unit

Parameters

blurRadius
Int32

The blur radius to use for window background blur in pixels

Attributes

Remarks

Blurs the screen behind the window within the bounds of the window.

The density of the blur is set by the blur radius. The radius defines the size of the neighbouring area, from which pixels will be averaged to form the final color for each pixel. The operation approximates a Gaussian blur. A radius of 0 means no blur. The higher the radius, the denser the blur.

The window background drawable is drawn on top of the blurred region. The blur region bounds and rounded corners will mimic those of the background drawable.

For the blur region to be visible, the window has to be translucent (see android.R.attr#windowIsTranslucent) and floating (see android.R.attr#windowIsFloating).

Note the difference with WindowManager.LayoutParams#setBlurBehindRadius, which blurs the whole screen behind the window. Background blur blurs the screen behind only within the bounds of the window.

Some devices might not support cross-window blur due to GPU limitations. It can also be disabled at runtime, e.g. during battery saving mode, when multimedia tunneling is used or when minimal post processing is requested. In such situations, no blur will be computed or drawn, resulting in a transparent window background. To avoid this, the app might want to change its theme to one that does not use blurs. To listen for cross-window blur enabled/disabled events, use WindowManager#addCrossWindowBlurEnabledListener.

Java documentation for android.view.Window.setBackgroundBlurRadius(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to