gpt4 book ai didi

Android - LinearLayout Horizo​​ntal with wrapping children

转载 作者:IT老高 更新时间:2023-10-28 13:10:02 24 4
gpt4 key购买 nike

是否有要为 Android 的 LinearLayout 设置的属性使其能够正确包装子控件?

含义 - 我有可变数量的 child ,并希望将它们水平排列,例如:

Example: Control1, Control2, Control3, ...

我通过设置来做到这一点:

ll.setOrientation(LinearLayout.HORIZONTAL);foreach (Child c in children)  ll.addView(c);

但是,如果我有很多 child ,最后一个会被切断,而不是转到下一行。

知道如何解决这个问题吗?

最佳答案

截至 2016 年 5 月,Google 创建了自己的 FlexBoxLayout,应该可以解决您的问题。

您可以在此处找到 GitHub 存储库:https://github.com/google/flexbox-layout

关于Android - LinearLayout Horizo​​ntal with wrapping children,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2961777/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com