Back to project page inotes.
The source code is released under:
GNU General Public License
If you think the Android project inotes listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.codeminders.inotes.ui; //from w w w .j av a 2s . co m import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Rect; import android.util.AttributeSet; import android.widget.EditText; import com.codeminders.inotes.R; public class LinedEditText extends EditText { private Rect rect; private Paint paint; public LinedEditText(Context context, AttributeSet attrs) { super(context, attrs); rect = new Rect(); paint = new Paint(); paint.setStyle(Paint.Style.FILL_AND_STROKE); paint.setColor(Color.parseColor(context.getString((R.color.lined_edit_line)))); } @Override protected void onDraw(Canvas canvas) { int height = getHeight(); int line_height = getLineHeight(); int count = height / line_height; if (getLineCount() > count) { count = getLineCount(); } int baseline = getLineBounds(0, rect); for (int i = 0; i < count; i++) { canvas.drawLine(rect.left, baseline + 1, rect.right, baseline + 1, paint); baseline += getLineHeight(); } super.onDraw(canvas); } }