draw multiple lines on editText
<p>I want to create a notepad. I am referring to sample notepad that provided by android sdk. My problem is I failed to draw multiple lines on editText. I am successfully run the program but there is nothing shows on the editText and even worse I couldn't input a word onto it. Here is my code. Thank you for helping.</p>

<p>On view, I have double confirm with my class path.So, I don't think there is any problem with my class path.</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"&gt;

    &lt;TextView 
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:id="@+id/layouteditbottom"
        android:layout_alignParentBottom="true"
        android:paddingBottom="18dp"
        /&gt;  

    &lt;RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:paddingBottom="5dp"
        android:paddingTop="5dp"
        android:layout_above="@+id/layouteditbottom"&gt;
        &lt;TextView android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="18sp" 
            android:text="@string/title"
            android:id="@+id/title_text1" /&gt;

        &lt;EditText android:id="@+id/title"
            android:layout_toRightOf="@+id/title_text1"             
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:singleLine="true"
            android:imeOptions="actionNext"
            android:textSize="18sp"/&gt;

        &lt;View xmlns:android="http://schemas.android.com/apk/res/android"
            class="com.example.apps2.MainActivity$LineEditText"
            android:id="@+id/body"
            android:layout_below="@+id/title"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:background="@android:color/transparent"
            android:padding="5dp"
            android:scrollbars="vertical"
            android:fadingEdge="vertical"
            android:gravity="top"
            android:textSize="22sp"
            android:capitalize="sentences"/&gt; 
    &lt;/RelativeLayout&gt;
&lt;/RelativeLayout&gt;
</code></pre>

<p>Code below is java.</p>

<pre><code>public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);     

    }

     public static class LineEditText extends EditText{
            // we need this constructor for LayoutInflater
            public LineEditText(Context context, AttributeSet attrs) {
                super(context, attrs);
                    mRect = new Rect();
                    mPaint = new Paint();
                    mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
                    mPaint.setColor(Color.BLUE);
            }

            private Rect mRect;
            private Paint mPaint;       

            @Override
            protected void onDraw(Canvas canvas) {
                //int count = getLineCount();

                int height = getHeight();
                int line_height = getLineHeight();

                int count = height / line_height;

                if (getLineCount() &gt; count)
                    count = getLineCount();//for long text with scrolling

                Rect r = mRect;
                Paint paint = mPaint;
                int baseline = getLineBounds(0, r);//first line

                for (int i = 0; i &lt; count; i++) {

                    canvas.drawLine(r.left, baseline + 1, r.right, baseline + 1, paint);
                    baseline += getLineHeight();//next line
                }

                super.onDraw(canvas);
           }

    }   

}
</code></pre>
