Android EdtiText 添加表情

SpannableString spannableString = new SpannableString(mEditText.getText().toString()+"1234");

Drawable d = getResources().getDrawable(R.drawable.emoji_0036);

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

ImageSpan span = new ImageSpan(d,ImageSpan.ALIGN_BASELINE);

spannableString.setSpan(span, mEditText.getText().toString().length(), (mEditText.getText().toString()+"1234").length(), ImageSpan.ALIGN_BASELINE);

mEditText.setText(spannableString);


你可能感兴趣的:(android,表情)