过去 3 天我一直在尝试在默认的 android 消息 View 中显示图形自定义表情符号。我已经成功地展示了我的自定义表情符号来代替 key 。现在的问题是我试图在可跨度字符串生成器中显示一个可绘制对象。但是drawable只是没有出现在键盘上。到目前为止的代码如下:
SpannableString ss = new SpannableString(" ");
Drawable d = getResources().getDrawable(R.drawable.a);
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
// ImageSpan span = new ImageSpan(d, ImageSpan.ALIGN_BASELINE);
ImageSpan span = new ImageSpan(d);
// ss.setSpan(span, 0, 1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
mComposing.append(":");
mComposing.setSpan(new ImageSpan(d), 0,1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
getCurrentInputConnection().commitText(mComposing, 1);
我尝试了不同的方法来以某种方式适应可绘制对象,但它不会显示在 android 的默认消息 View 上。任何帮助将不胜感激。
最佳答案
关于java - 在 Android 键盘中显示自定义表情,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14641013/