我试图将100个动态按钮添加到可以响应html div的任何布局中。
示例布局-
[1] [2] [3] [4] [5] [6] [7] //end of right screen
[8] [9] [10] [11] [12] [13]
... to [100]
为了得到结果,我测试了一些代码
for (int i = 1; i < 101; i++) {
Button btn = new Button(this);
btn.setText("" + i);
LinearLayoutVertical.addView(btn);
}
它给了我完整的父级宽度按钮,并且占用了太多空间。如何获得自动换行的内容按钮,就像HTML中一样。