I want to blur the text of a TextView, but the text is cut off left and right.
Image of the cut off text

I tried to increase padding, margin. Changed gravity, Enabled/disabled font padding. Set a fixed height, lowered font size etc. All to the same result: The sides were cut off.
The setting of the mask filter is just two lines:
textView.paint.maskFilter = BlurMaskFilter(radius, BlurMaskFilter.Blur.NORMAL)
textView.postInvalidate()
This is how my XML layout looks like:
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="-1dp"
android:includeFontPadding="false"
android:layerType="software"
android:textSize="48sp"
tools:textColor="@color/solid_white"
tools:text="132" />
I'm looking for a solution to see the text fully without cutoffs on the edges.
Remove this attribute from your <TextView> tag:
android:layerType="software"
Hardware acceleration is required for views to draw outside of their bounds. Note that padding doesn't help here because view contents are clipped by padding as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With