我目前正在尝试实现类似网格的"列表,因为它可以在我添加的图像中看到。我的想法是,当我添加"群组" (Pre-Kinder A等),列表将继续增长,溢出应该修改框的高度。 我现在遇到的问题是我无法控制项目添加到视图中的方式,我将以编程方式添加以下代码:
LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
TagButton tagButton = new TagButton(getApplicationContext(), c);
tagButton.setLayoutParams(lp);
tagButton.setBackgroundResource(R.drawable.date_button);
this.tagsButton.add(tagButton);
我无法找到添加更多群组的方法,而不是将这些群组添加到右侧(甚至无法看到),我需要将它们添加到新的"行&#34 ;. 任何关于如何解决这个问题的想法都会受到高度赞赏。
以下是我尝试添加大量群组时应用的外观:
提前致谢!
答案 0 :(得分:0)
感谢Funkystein的回答,在谷歌搜索了一下关于flowlayout之后,我可以按照此链接上的说明解决我的问题:
How can I do something like a FlowLayout in Android?
下载项目后,您必须基本上将实现复制并粘贴到您想要制作的视图上,并且#34; flowlayout-able"