Android, How To Draw Dotted Line In Edittext
I refered to this link: How do I make a dotted/dashed line in Android?, and used DashPathEffect. But this does not work for me? why? my code: public class NoteEditText extends Edit
Solution 1:
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);
Solution 2:
newfloat[]{5,5,5,5}
try
newfloat[]{5,10,15,20}
Solution 3:
This should work.
EditText editText=(EditText) v.findViewById(android.R.id.text1);
editText.setPaintFlags(editText.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
Solution 4:
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
Post a Comment for "Android, How To Draw Dotted Line In Edittext"