I have created a custom EditText class which draws line numbers next on the left of every line. This works fine however I also want to set background of the line numbers to grey and achieve something like this:
In onDraw method where I draw the numbers I tried to draw really thick line but it always gets drawn over the line numbers no matter where I put it, before the call the draws the line numbers or after. Here is my code
protected void onDraw(Canvas canvas) {
int baseline = getBaseline();
for (int i = 0; i < getLineCount(); i++) {
//line still gets drawn over the text
canvas.drawText("" + (i + 1), rect.left, baseline, paint);
canvas.drawLine(rect.left,baseline,rect.right,rect.top,fill);
canvas.drawText("" + (i + 1), rect.left, baseline, paint);
baseline += getLineHeight();
}
super.onDraw(canvas);
}
Any suggestions about how to make the line appear in the background?
Thanks