Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blurView在compose中无效 #207

Closed
aacai opened this issue Sep 24, 2023 · 0 comments
Closed

blurView在compose中无效 #207

aacai opened this issue Sep 24, 2023 · 0 comments

Comments

@aacai
Copy link

aacai commented Sep 24, 2023

在jetpack compose官方的与View交互AndroidView中,模糊效果不生效

AndroidView(
    modifier = Modifier
        .fillMaxSize()
        .border(width = 5.dp, color = Color.Red),
    factory = { context ->
        LinearLayout(context).apply {
            orientation = LinearLayout.VERTICAL
            layoutParams = ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT
            )
            addView(ImageView(context).apply {
                setImageResource(R.drawable.ic_wallpaper)
                layoutParams = ViewGroup.LayoutParams(
                    ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.MATCH_PARENT
                )
            })

            addView(BlurView(context).apply {
                setupWith(viewGroup, getBlurAlgorithm(context))
                    .setFrameClearDrawable(
                        context.getDrawable(R.drawable.ic_wallpaper)
                    )
                    .setBlurEnabled(true)
                    .setBlurRadius(30f)
                setOverlayColor(android.graphics.Color.RED)
                layoutParams = ViewGroup.LayoutParams(
                    ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.MATCH_PARENT
                )

            })
        }
    })

但是在传统的View中使用却没问题,我在哪里出错了呢,还是程序的bug?

@Dimezis Dimezis closed this as completed May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants