2

I have EditText and I'm adding images on it after adding an image if i wrote with keyboard everything is fine but when pressing space button once or twice or ... the cursor get same height of the image so when it goes to a new line the new line appears as height as the picture . can someone help me with this. It is same issue here TextView with ImageSpan messes up line height

 private void addImageBetweentext(Drawable drawable) {


    drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());

    int selectionCursor = editText.getSelectionStart();
    editText.getText().insert(selectionCursor, "  .");
    selectionCursor = editText.getSelectionStart();

    SpannableStringBuilder builder = new SpannableStringBuilder(editText.getText());
    builder.setSpan(new ImageSpan(drawable), selectionCursor - "  ".length(), selectionCursor, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    editText.setText(builder);

    editText.setSelection(selectionCursor);

the PRoblem Is on Android 6

Community
  • 1
  • 1

0 Answers0