Skip to content Skip to sidebar Skip to footer

Set Text In Textview Very Blurry

I'm looking into methods of completely blurring a text in a textview. Read, completely unreadable (pixelate). The methods i'm using now are using shadows. But this seems very ineff

Solution 1:

I did not like the Paint method used in the other answers. The below code is working for me with the radius calculated depending on the font size and applying it directly on the TextView.

if (Build.VERSION.SDK_INT >= 11) {
     yourTextView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
floatradius= yourTextView.getTextSize() / 3;
BlurMaskFilterfilter=newBlurMaskFilter(radius, BlurMaskFilter.Blur.NORMAL);
yourTextView.getPaint().setMaskFilter(filter);

Solution 2:

You should try to use canvas instead of TextView and draw a text with blur. There is a lot of method using BlurMaskFilter and you can use this like that :

paint.setMaskFilter(newBlurMaskFilter(float radius, BlurMaskFilter.Blur style));

Solution 3:

You may try below methods:

  1. Whenever you want to show blurry text, use a specialized font for your TextView, added to asset folder of your project.
  2. Try setting a transparent color[#00ffffff] to your text and give some shadow to it.

I hope one of the above method helps.

Post a Comment for "Set Text In Textview Very Blurry"