Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/QmDeve/QmBlurView-Docs/llms.txt

Use this file to discover all available pages before exploring further.

BlurSwitchButtonView is an Android toggle switch that renders a real-time frosted-glass blur effect behind the thumb and track. Its key design feature is a single-color API: you supply one base color and the library automatically derives the correct tints for both the on and off states — no manual color pairing required.

Usage

<com.qmdeve.blurview.widget.BlurSwitchButtonView
    android:layout_width="65dp"
    android:layout_height="wrap_content"
    app:baseColor="#0161F2" />

Attribute Description

Attribute NameTypeDefault ValueDescription
app:baseColorcolor#0161F2Base color; on/off states are auto-calculated from this value
app:useSolidColorModebooleanfalseEnable solid (non-blur) color mode
app:solidOnColorcolorSets the solid “on” state color (only applied when useSolidColorMode is true)
app:solidOffColorcolorSets the solid “off” state color (only applied when useSolidColorMode is true)

API Reference

MethodDescription
setBaseColor(int)Set the base color for the switch
setUseSolidColorMode(boolean)Enable or disable solid (non-blur) color mode
isUseSolidColorMode()Returns whether solid color mode is currently enabled
setSolidColors(int onColor, int offColor)Set explicit solid colors for the on and off states
getSolidOnColor()Returns the current solid on-state color
getSolidOffColor()Returns the current solid off-state color
setOnCheckedChangeListener(listener)Register a callback invoked when the checked state changes
You only need to set the base color. BlurSwitchButtonView automatically calculates the on and off state colors from the base color value.

Listening to State Changes

Use setOnCheckedChangeListener to react whenever the user toggles the switch:
blurSwitch.setOnCheckedChangeListener(isChecked -> {
    if (isChecked) {
        // Switch is ON
    } else {
        // Switch is OFF
    }
});

Build docs developers (and LLMs) love