1. 在Java代码中动态添加控件
2. 在XML布局中不添加
3. 先获得布局的id
4. 得到布局Linearlayout llGroup=(LinearLayout)findViewById(R.id.ll);
向布局中添加控件:
TextView tv=new TextView(this);
tv.setText(“alkf”);
llGroup.addView(tv);
1. 在Java代码中动态添加控件
2. 在XML布局中不添加
3. 先获得布局的id
4. 得到布局Linearlayout llGroup=(LinearLayout)findViewById(R.id.ll);
向布局中添加控件:
TextView tv=new TextView(this);
tv.setText(“alkf”);
llGroup.addView(tv);