androidkotlinandroid-jetpack-composeandroid-jetpack-compose-preview

Blur Modifier in Jetpack Compose Doesn't Work in Preview


I'm trying to use the Modifier.blur feature of Jetpack Compose for a project for work and it seems to not do anything in the preview. I'm using it like this:

Column(modifier = Modifier
    .blur(30.dp)) {
    // Screen content here
}

The screen content isn't blurred at all. I've even tried applying blur to the individual composables in the box and that also doesn't change the preview. Am I missing something here?


Solution

  • Modifier.blur() works only on Android 12+ devices so you probably do not want to use it anyways since it will not work for almost all your users (at least at the time I am writing this that barely any devices run Android 12).

    It's due to all blur-related features being added on Android 12+ and they are not backward compatible. So you always do need unofficial methods to implement blur if you do want it to work for devices running Android 11 or lower.

    It not working on the preview can be due to this or might simply be a bug since Compose is still new. I could not find any reported bugs related to blur so if it's a bug, they are not aware of it. If you are sure it is a bug you should report it to Google's issue tracker so it can get fixed ASAP.