android中有没有类似flowlayout的布局?
我在 android build in 布局中找不到任何相关的布局实现。
我在这篇文章中找到了一个实现,Android 的换行小部件布局,但在那篇文章的情况下,有一个前提条件,即子级的宽度不比父级的宽度宽。
但就我而言,孩子的宽度比父母的更宽。就像说,布局中有一个textview和一张图像,布局的宽度是200,而textview的整个宽度是300,图像的宽度是50。android
中是否有内置实现?或者关于如何自己实现这个布局有什么建议吗?
谢谢。
I can not find any related layout implementation in android build in layouts.
I found one implementation in this post, Line-breaking widget layout for Android, but in that post's case, there is a precondition that the child's width is not wider than the parent's.
But in my case, the child's width is wider than the parent's. Like say, there is one textview and one image in the layout, the layout's width is 200, while the textview's whole width is 300, and the image's width is 50.
Any build-in implementation in android for this ? Or any suggestion about how to implement this layout by myself ?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这在数学上是不可能的。
这在数学上是不可能的。您的布局的宽度必须至少与其最大的子布局一样大。
That is mathematically impossible.
That is mathematically impossible. Your layout's width has to be at least as large as its largest child.
我找到了解决方案,即使用 ImageSpan,然后调用 SpannableStringBuilder.setSpan 方法。
I found the solution, which is to use ImageSpan, and then invoked SpannableStringBuilder.setSpan method.