Android image wrapped in text.

I would like to insert an image into the text, for example:

I would like to show the text likie this:

"To edit the image, you must click the" [image] "button.

Where [image] is the real image (for example, ImageView)

+2
source share
1 answer

you can try this, I don't know if you need this problem:

setContentView(R.layout.main); TextView textView = (TextView) findViewById(R.id.textview); SpannableString ss = new SpannableString("abc"); Drawable d = getResources().getDrawable(R.drawable.icon32); 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); textView.setText(ss); 
+6
source

Source: https://habr.com/ru/post/901814/


All Articles