Skip to content Skip to sidebar Skip to footer

How Do I Setmaskfilter Without Crash On Android O?

I use a RecyclerView in my grid. Each item has textview and Imageview. I set mask filter for textview in my Adapter as below: float[] direction = new float[]{0.0f, -1.0f, 0.5f};

Solution 1:

This is known bug. Problem in method canvas.drawText(); But I found a way to avoid crash, by using canvas.drawPath(); instead.

Path path = new Path();
paint.getTextPath( text, 0, text.length(), x, y, path );
canvas.drawPath( path, paint );

If you want to use it in TextView you have to extend this class and create new onDraw method. Enjoy!

Post a Comment for "How Do I Setmaskfilter Without Crash On Android O?"