android弹出dialog后activity背景变暗


builder = new AlertDialog.Builder(this);
LayoutInflater inflater = LayoutInflater.from(this);
View view = inflater.inflate(R.layout.collection_dialog, null);
TextView qian = (TextView) view.findViewById(R.id.collec_money);
TextView prompt = (TextView) view.findViewById(R.id.prompt);
iv_QRCode_ImageView = (ImageView) view
.findViewById(R.id.iv_QRCode_ImageView);
prompt.setText(R.string.weixincode);
 Button savecode = (Button)view.findViewById(R.id.savecode);
String name = PreUtils.getStringFromPreference(getApplicationContext(),
PreUtils.USER_NAME);

builder.setView(view);
builder.create();

dialog = builder.show();

   //点击dialog周边的暗色,dialog消失,用此事件监听dialog的消失

dialog.setOnDismissListener(new OnDismissListener(){


@Override
public void onDismiss(DialogInterface dialog) {
// TODO Auto-generated method stub
flagremark  = false;
// Toast.makeText(getApplicationContext(), flagremark+"", Toast.LENGTH_SHORT).show();
}

});

    //设置弹出dialog后activity背景色,取消dialog周边变暗的效果

// Window window = dialog.getWindow();
// WindowManager.LayoutParams lp = window.getAttributes();
// lp.dimAmount =0f;
// window.setAttributes(lp);

你可能感兴趣的:(android)