Basically I want to do something like this in Android:
I am trying to draw horizontal lines in a custom EditText, and then typing on these lines.
I am using the text size for the distance between two horizontal lines. However, the size of cursor and that of text is not same. Hence, I am not able to maintain placing text "on" these lines.
The alignment of the text base to these horizontal lines are not coming as proper.
Here is the code used for drawing the lines:-
float textSize = getTextSize());
Paint paint = new Paint();
for (int i = 0; i < 50; i++) {
canvas.drawLine(0, textSize * i, getWidth(), textSize * i, paint);
}
EditText doesn't privides has any method for getting the cursor size.
Kindly suggest if there is any workaround for this, or any other better way of doing this.
A custom EditText that draws lines between each line of text that is displayed:
Now use object of LinedEditText class where you need.
An Example:
The Output: