android, how to draw dotted line in edittext

青春壹個敷衍的年華 提交于 2019-11-29 14:58:39

The method setPathEffect is not supported by hardware acceleration. By default it is turned on (I think since Android 4.0)

http://developer.android.com/guide/topics/graphics/hardware-accel.html#unsupported

You can turn off hardware acceleration inside the constructor with following code snippet:

setLayerType(View.LAYER_TYPE_SOFTWARE, null);

new float[]{5,5,5,5}

try

new float[]{5,10,15,20}

This should work.

EditText editText=(EditText) v.findViewById(android.R.id.text1);

editText.setPaintFlags(editText.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);

ruidge

I don't think you should use the "for loop" to draw line.set setStrokeWidth($diameter) maybe useful. I have write a simple view supporting this function,detail Here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!