首页 > 代码库 > Android EdtiText 添加表情

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 EdtiText 添加表情