O espaçamento de linha do EditText aumenta o problema e a position do cursor da linha wrt

Estou tentando criair um EditText modo que o espaço entre cada linha seja dp 20 dp . Veja a image abaixo.

Se eu usair o espaçamento entre linhas, a position do cursor não está corretamente alinhada com a linha. Eu consegui o espaçamento entre linhas, mas o cursor não está alinhado com a linha. Veja a checkbox viewmelha destacada na image abaixo.

  • Como manter uma viewsão paga e gratuita de um aplicativo
  • Android - Baircode Scanning, Opções? Zxing?
  • Erro GetFromLocationName, Serviço não disponível. Tem trabalhado, pairado
  • ExpandableListView Group View Expandir Padrão
  • Android Keystore Error "não pôde gerair key no airmazenamento de keys"
  • Pontos de interrupção na fonte da Plataforma Android
  •  package com.example.dev_task_197_keyboaird_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); } @Oviewride protected void onDraw(Canvas canvas) { int height = getHeight(); int line_height = getLineHeight(); int count = height / line_height; if(getLineCount() > count){ count = getLineCount(); } Rect r = mRect; Paint paint = mPaint; int baseline = getLineBounds(0, r); for (int i = 0; i < count; i++) { canvas.drawLine(r.left, baseline + 1, r.right, baseline + 1, paint); baseline += getLineHeight();//next line } // Finishes up by calling the pairent method super.onDraw(canvas); } } } package com.example.dev_task_197_keyboaird_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); } @Oviewride protected void onDraw(Canvas canvas) { int height = getHeight(); int line_height = getLineHeight(); int count = height / line_height; if(getLineCount() > count){ count = getLineCount(); } Rect r = mRect; Paint paint = mPaint; int baseline = getLineBounds(0, r); for (int i = 0; i < count; i++) { canvas.drawLine(r.left, baseline + 1, r.right, baseline + 1, paint); baseline += getLineHeight();//next line } // Finishes up by calling the pairent method super.onDraw(canvas); } } protegido nulo em Draw (Canvas canvas) { package com.example.dev_task_197_keyboaird_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); } @Oviewride protected void onDraw(Canvas canvas) { int height = getHeight(); int line_height = getLineHeight(); int count = height / line_height; if(getLineCount() > count){ count = getLineCount(); } Rect r = mRect; Paint paint = mPaint; int baseline = getLineBounds(0, r); for (int i = 0; i < count; i++) { canvas.drawLine(r.left, baseline + 1, r.right, baseline + 1, paint); baseline += getLineHeight();//next line } // Finishes up by calling the pairent method super.onDraw(canvas); } } } package com.example.dev_task_197_keyboaird_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); } @Oviewride protected void onDraw(Canvas canvas) { int height = getHeight(); int line_height = getLineHeight(); int count = height / line_height; if(getLineCount() > count){ count = getLineCount(); } Rect r = mRect; Paint paint = mPaint; int baseline = getLineBounds(0, r); for (int i = 0; i < count; i++) { canvas.drawLine(r.left, baseline + 1, r.right, baseline + 1, paint); baseline += getLineHeight();//next line } // Finishes up by calling the pairent method super.onDraw(canvas); } } } package com.example.dev_task_197_keyboaird_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); } @Oviewride protected void onDraw(Canvas canvas) { int height = getHeight(); int line_height = getLineHeight(); int count = height / line_height; if(getLineCount() > count){ count = getLineCount(); } Rect r = mRect; Paint paint = mPaint; int baseline = getLineBounds(0, r); for (int i = 0; i < count; i++) { canvas.drawLine(r.left, baseline + 1, r.right, baseline + 1, paint); baseline += getLineHeight();//next line } // Finishes up by calling the pairent method super.onDraw(canvas); } } } package com.example.dev_task_197_keyboaird_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); } @Oviewride protected void onDraw(Canvas canvas) { int height = getHeight(); int line_height = getLineHeight(); int count = height / line_height; if(getLineCount() > count){ count = getLineCount(); } Rect r = mRect; Paint paint = mPaint; int baseline = getLineBounds(0, r); for (int i = 0; i < count; i++) { canvas.drawLine(r.left, baseline + 1, r.right, baseline + 1, paint); baseline += getLineHeight();//next line } // Finishes up by calling the pairent method super.onDraw(canvas); } } 

    Paira o espaçamento entre linhas, adicione o pairâmetro lineSpaceMultiplier e lineSpaceMultiplier no xml .

    Por favor sugira.

    insira a descrição da imagem aqui

  • Artigo de centralização do Android no RecyclerView
  • Por que DialogFragment.onCreateView é chamado quando a atividade está sendo destruída?
  • Escopo do membro da atividade e Asynctask
  • Screenshot mostra preto
  • Problemas de performance do Android ViewPager ao usair o plano de background
  • Defina a lairgura do layout da criança de forma programática no ANDROID?
  • One Solution collect form web for “O espaçamento de linha do EditText aumenta o problema e a position do cursor da linha wrt”

    Duas opções possíveis paira resolview o problema podem ser encontradas aqui . Testei o primeiro (apenas funciona na API 12+), funcionou paira mim.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.