包裹文字的Android图像 [英] android image wrapped by text
本文介绍了包裹文字的Android图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想插入图像插入文字,例如:
I would like to insert image into text, for example:
我想显示的文字likie这样的:
I would like to show the text likie this:
要编辑的图片,你应该点击[图]按钮。
"To edit picture you should click on" [image] "button."
其中[图片]是真实的图像(如ImageView的)
Where [image] is real image (e.g. ImageView)
推荐答案
你可以试试这个,我DONOT知道这是不是你的需要:
you can try this,i donot know if this is your need:
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);
这篇关于包裹文字的Android图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文