Dimezis / BlurView

Dynamic iOS-like blur of underlying Views for Android
Apache License 2.0
3.48k stars 331 forks source link

TextView doesn't get blurred #181

Closed OrhanTozan closed 2 years ago

OrhanTozan commented 2 years ago

I have a framelayout with a textview and a blurview above. The textview doesn't get blurred.

Dimezis commented 2 years ago

Please show examples, code, layout and screenshots. I can't guess based on 1 sentence

OrhanTozan commented 2 years ago

@Dimezis

this is the XML

<FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="64dp"
            android:layout_marginTop="16dp"
            android:layout_marginBottom="16dp"
            android:fontFamily="@font/helveticaneue_bold"
            android:text="@{weekLabel.text}"
            android:textColor="#6F6F6F"
            android:textSize="14sp"
            tools:text="Week 17, 20-27 april" />

        <eightbitlab.com.blurview.BlurView
            android:id="@+id/blurView"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

        </eightbitlab.com.blurview.BlurView>

    </FrameLayout>

and

binding.blurView.setupWith(parent)
                    .setBlurAlgorithm(RenderScriptBlur(parent.context))
                    .setBlurRadius(25f)
                    .setBlurAutoUpdate(true)
Dimezis commented 2 years ago

What's the parent? If it doesn't have a background, the blurred TextView gets blended with a transparent background resulting in a low alpha.

Check on a smaller blur radius or much bigger TextView. If it's indeed the problem, use setFrameClearDrawable as the example project suggests

OrhanTozan commented 2 years ago

@Dimezis I just changed it, and passed the framelayout to the setupWith() parameter. Still the same result.

Do you mean the parent of the framelayout? I think it is the Recyclerview viewholder viewgroup that is the parent

Dimezis commented 2 years ago

I mean what's the parent var here in your code binding.blurView.setupWith(parent)? Can you send the screenshot with and without the BlurView? Did you try setFrameClearDrawable?

OrhanTozan commented 2 years ago

@Dimezis I fixed it by changing the framelayouts height from wrap_content to a 75dp. Do you perhaps know why wrap_content isn't supported?

Dimezis commented 2 years ago

Because BlurView is a FrameLayout.

And FrameLayout with a match_parent size inside of another FrameLayout parent with wrap_content size resolves itself to a 0 size.

OrhanTozan commented 2 years ago

Ok, would not expect that. Would expect it to keep its height to match the parent, as the name says.

Dimezis commented 2 years ago

It's tricky, yes. But not a BlurView issue, so I'm closing it