android imagespan不支持自动下一行
android ImageSpan,在textview中,当最后一个位置显示大图像很小,但我的图像很大,我想要ImageSpan自动 下一行。我尝试重载大小方法并更改大小 等于textview宽度,但不能解决
SpanabeleString contentSS=new SpanabeleString("hello word on the line [image]");
contentSS.setSpan(imageSpan,"[image]".start,"start".length,xxx);
//imageSpan not support auto new line;
我无法更改内容的问题,我希望使用imagespan实现auto 下一行函数
android ImageSpan, in textview when last position show a big image is little,but my image is very big,I want to the ImageSpan auto
next line . I try overload size method and change size
equal textview width, but doesn't solve the problem
SpanabeleString contentSS=new SpanabeleString("hello word on the line [image]");
contentSS.setSpan(imageSpan,"[image]".start,"start".length,xxx);
//imageSpan not support auto new line;
I cannot change content,I hope use imagespan implement auto
next line function
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ImageSpan 是 ReplacementSpan 的间接子类。显然,ReplacementSpan(因此是 ImageSpan)无法做到换行。这里引用了一篇文章 绘制圆角背景关于文本,作者:Florina Muntenescu,她在博客中介绍了跨度等内容。 (以下引用中的强调是我的。)
我认为这是您遇到的流动问题。作为解决方法,您可以在出现这种情况时自行插入换行符。据我所知,没有办法告诉 ImageSpan 换行。
An ImageSpan is an indirect subclass of ReplacementSpan. Flowing onto a new line is, evidently, something that
ReplacementSpan
(therefore an ImageSpan) cannot do. Here is a quote from an article Drawing a rounded corner background on text by Florina Muntenescu who blogs about spans and the like. (Emphasis in the following quote is mine.)I think that this is the flowing issue that you are having. As a work-around, you can insert the newline yourself when the condition occurs. There is no way that I know of to tell the ImageSpan to wrap.