我有EditText,如果我用键盘写一切都很好,但是当按一次或两次空格按钮时,我在添加图像后添加图像,或者......光标得到相同的图像高度,所以当它进入新line 新行显示为图片的高度。有人可以帮我弄这个吗。这是同样的问题, TextView with ImageSpan 弄乱了行高
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);
问题出现在 Android 6 上