title: EditText line spacing increase issue and cursor position w.r.t line
body: <p>I am trying to create an <code>EditText</code> such that the space between each line should be like 20 <code>dp</code>. Please see the image below.</p>
  
  <p>If I use line spacing extra, then the cursor position is not correctly aligned with the line. 
  I have achieved the line spacing, but the cursor is not aligned with the line. See the red box highlighted in the image below.</p>
  
  <pre><code>package com.example.dev_task_197_keyboard_accesory;
  
  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;
  
  public class LineEditText extends EditText {
      private Rect mRect;
      private Paint mPaint;
  
      // 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); //SET YOUR OWN COLOR HERE
          setMinLines(15);
      }
  
      @Override
      protected void onDraw(Canvas canvas) {
          int height = getHeight();
          int line_height = getLineHeight();
  
          int count = height / line_height;
          if(getLineCount() &gt; count){
              count = getLineCount();
          }
          Rect r = mRect;
          Paint paint = mPaint;
          int baseline = getLineBounds(0, r);
  
          for (int i = 0; i &lt; count; i++) {
  
              canvas.drawLine(r.left, baseline + 1, r.right, baseline + 1, paint);
              baseline += getLineHeight();//next line
          }
  
          // Finishes up by calling the parent method
          super.onDraw(canvas);
      }
  }
  </code></pre>
  
  <p>For line spacing, add <code>lineSpaceExtra</code> and <code>lineSpaceMultiplier</code> parameter in the <code>xml</code>.</p>
  
  <p>Please suggest.</p>
  
  <p><img src="https://i.stack.imgur.com/Kt6kt.png" alt="enter image description here"></p>