BlurView does not blur the image in bottom sheet
BlurView does not blur the image in bottom sheet but it blurs the image that is in the fragment under bottom sheet
If you want me to help, please put more effort into describing the issue. Post your screenshots, layout, and how you set up your BlurView. Or just send a sample project ideally
binding.blurView.setup(Constants.BLUR_RADIUS, backgroundResource = R.drawable.blur_background_darker_30)
fun BlurView.setup(radius: Float, backgroundResource: Int = R.drawable.grey_background_2, hasFixedTransformationMatrix: Boolean = false) { val activity = getActivity() ?: return val decorView: View = activity.window.decorView val rootView = decorView.findViewById<View>(android.R.id.content) as ViewGroup val windowBackground = decorView.background with(this) { setBackgroundResource(backgroundResource) outlineProvider = ViewOutlineProvider.BACKGROUND clipToOutline = true
setupWith(rootView)
.setBlurAlgorithm(RenderScriptBlur(this.context))
.setFrameClearDrawable(windowBackground)
.setBlurRadius(radius)
.setBlurAutoUpdate(true)
.setHasFixedTransformationMatrix(hasFixedTransformationMatrix)
}
}
This is inside bottom sheet, the blur does not blur the img, but it blurs what is on the fragment under the bottomsheet: <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/tryAgainLayout" android:layout_width="match_parent" android:layout_height="0dp" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> <ImageView android:id="@+id/img" android:layout_width="match_parent" android:layout_height="wrap_content" android:scaleType="centerCrop" android:src="@drawable/ic_game_bg" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" />
<eightbitlab.com.blurview.BlurView
android:id="@+id/blurView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginHorizontal="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="2:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="28dp"
android:alpha="1"
android:fontFamily="@font/inter"
android:text="Try Later for a New Opportunity!"
android:textAlignment="center"
android:textColor="@color/colorWhite"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</eightbitlab.com.blurview.BlurView>
</androidx.constraintlayout.widget.ConstraintLayout>
the blur does not blur the img
What image?
but it blurs what is on the fragment under the bottomsheet
That's basically what it's supposed to do - it blurs the views that are inside the rootView you're passing to it.
If the target you want to blur is in a different window like the bottom sheet is, pass the root view that contains the content you want to blur.