我可以在Android应用中向GridLayout添加新按钮吗?
与Java一样:
JButton buttons[]={button1,button2,button3,button4,button5,button6,button7,button8,button9,button10,button11,button12, button13,button14,button15,button16,button17,button18,button19,button20,button21,button22,button23,button24};
...
for(int i=0; i<24;i++)
window.add(buttons[i]);
是否可以在Android中执行类似操作?因为我想将我的按钮放在随机放置的4x6网格中。我用简单的Java做到了,但我不知道如何在Android中实现它。或者我应该使用GridView?
编辑:这是java(没有Android)中的代码:
private JFrame window = new JFrame("Name");
...
private JButton buttons[]={button1,button2,button3,button4,button5,button6,button7,button8,button9,button10,button11,button12, button13,button14,button15,button16,button17,button18,button19,button20,button21,button22,button23,button24};
...
for(i=0;i<24;i++)
window.add(buttons[i]);
...
Android的外观如何?