public void attachView(Activity activity) {
((ViewGroup) activity.getWindow().getDecorView()).addView(fullMaskView);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
params.gravity = Gravity.BOTTOM;
((ViewGroup) activity.getWindow().getDecorView()).addView(contentLayout, params);
}
public void attachToActivity(Activity activity) {
this.mActivity = activity;
// .... 省略部分代码
ViewGroup decor = (ViewGroup)activity.getWindow().getDecorView();
ViewGroup decorChild = (ViewGroup)decor.getChildAt(0);
decorChild.setBackgroundResource(background);
decor.removeView(decorChild);
this.addView(decorChild);
this.setContentView(decorChild);
decor.addView(this);
}