android中有没有类似flowlayout的布局?

发布于 2024-09-29 01:58:31 字数 362 浏览 1 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

2024-10-06 01:58:31

但就我而言,子级的宽度比父级的宽。

这在数学上是不可能的。

比如说,布局中有一个textview和一张图片,布局的宽度是200,而textview的整体宽度是300,图片的宽度是50。

这在数学上是不可能的。您的布局的宽度必须至少与其最大的子布局一样大。

But in my case, the child's width is wider than the parent's.

That is mathematically impossible.

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.

That is mathematically impossible. Your layout's width has to be at least as large as its largest child.

顾北清歌寒 2024-10-06 01:58:31

我找到了解决方案,即使用 ImageSpan,然后调用 SpannableStringBuilder.setSpan 方法。

I found the solution, which is to use ImageSpan, and then invoked SpannableStringBuilder.setSpan method.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文