开发者

How can i adding image on edittext dynamically?

开发者 https://www.devze.com 2023-01-15 21:20 出处:网络
I am developing form design for share image through email,so i am developingform for compose mail,i want to display some image in edit te开发者_如何学运维xt dynamically ,how can i add image in edit te

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消