想在主代码(不在XML)里构造Button二维数组(类似于button[][])并显示出来 应该如何写代码
解决方案 »
- SQLiteDatabase.query函数的作用及参数的含义
- MyEclipse 10.0 配置Android 开发环境
- 如何获取视频文件的视频宽度,高度?
- 使用安卓系统的浏览本地网页,不支持中文文件名
- Android Webkit网页里有“返回顶部”的链接点击无效
- Android初学者求助
- android下面ListView 显示某行高亮
- android 虚拟机的使用 ?? 帮帮忙!!!!
- 调试程序时怎样终止?
- 哪位朋友帮忙给个adt-bundle-windows-x86-20140624资源
- 怎么调用finish()返回时刷新父Activity的oncreat
- android应用的界面入口如何定位
Button[][] buttons = new Button[][]{};
buttons[1] = new Button[]{new Button(this), new Button(this)};
buttons[2] = new Button[]{new Button(this), new Button(this)};
buttons[0] = new Button[2];
buttons[1] = new Button[2];
buttons[0][0] = new Button(this);
buttons[0][1] = new Button(this);
buttons[1][0] = new Button(this);
buttons[1][1] = new Button(this);
ViewGroup layout = (ViewGroup)this.findViewById(R.id.main);
layout.addView(buttons[0][0]);
layout.addView(buttons[0][1]);
layout.addView(buttons[1][0]);
layout.addView(buttons[1][1]);