我想在Inflater构造出来的view上再动态添加几个button,怎么能做到啊?谢谢啦~LayoutInflater inflater = LayoutInflater.from(getApplicationContext());
View view = inflater.inflate(R.layout.layout_1, null);
TextView textView = (TextView)view.findViewById(R.id.main_text1);
textView.setText(""+i);
mViews.add(view);
View view = inflater.inflate(R.layout.layout_1, null);
TextView textView = (TextView)view.findViewById(R.id.main_text1);
textView.setText(""+i);
mViews.add(view);
这个view就是个viewGroup, 直接往里添加就行啊, 比如:
view.add(要添加的子view, 布局参数)
2)直接用ViewGroup的addView方法。注意要设置要layourparams