I have been trying for the last 3 days to show a graphical custom emoticon in the default android message view. I have successfully shown my custom emoticons in place of keys. Now the problem is that I am trying to show a drawable in spanable string builder. But the drawable just does not appear on the keyboard. Here is the code so far:
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);
I have tried different methods to somehow fit the drawable but it just wont show on the default message view of android. Any help would be highly appreciated.
May be this will be helpful: Emoticons-Keyboard
See this also: Implementations of Emoji (Emoticon) View/Keyboard Layouts
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With