先看代码:
public class MyviewGroup extends ViewGroup {
private final Context context;
private View view;
public MyviewGroup(Context context) {
super(context,null);
this.context = context;
}
public MyviewGroup(Context context, AttributeSet attrs) {
super(context, attrs);
this.context = context;
removeAllViews();
this.setFocusable(false);
this.setClickable(false);
this.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
initview();
}
private void initview() {
if (null == view){
view = LayoutInflater.from(context).inflate(R.layout.itme, null, true);
}
addView(view);
LinearLayout.LayoutParams params =
new android.widget.LinearLayout.LayoutParams(Layo