How can i adding image on edittext dynamically?
I am developing form design for share image through email,so i am developing form for compose mail,i want to display some image in edit te开发者_如何学运维xt dynamically ,how can i add image in edit text dynamically?
you can using this code
SpannableString ss = new SpannableString("abc");
Drawable d = img.getDrawable();
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
ImageSpan span = new ImageSpan(d, ImageSpan.ALIGN_BASELINE);
ss.setSpan(span, 0, 3, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
et.setText(ss);
You can't draw images in a EditText.
Look for some WYSIWYG editor for Android, but I couldn't find one so don't know if it exists.
The only way to do this is by creating a browse button and select a image which you can display in a ImageView and send the image as a attachment.
精彩评论