在我的代码中,我在弹出视图中显示警报。但是当我触摸任何背景按钮时,它们就会启用。我想禁用背景触摸。以下是我的代码。请检查一下。
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View popuplayoutReject = inflater.inflate(R.layout.popup_reject_request, (ViewGroup) findViewById(R.id.popup_element));
final PopupWindow popUpReject = new PopupWindow(popuplayoutReject, WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT, false);
ImageButton btnPopupReject_Ok, btnPopUpReject_Cancel;
TextView txtRequestRejectMessage = (TextView) popuplayoutReject.findViewById(R.id.errorMessage);
txtRequestRejectMessage.setText(getResources().getString(R.string.AddEntryNotSaved));
btnPopupReject_Ok = (ImageButton) popuplayoutReject.findViewById(R.id.btnPopup_Yes);
btnPopupReject_Ok.setImageResource(R.drawable.yes_button);
btnPopupReject_Ok.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
btnPopUpReject_Cancel = (ImageButton) popuplayoutReject.findViewById(R.id.btnPopUp_No);
btnPopUpReject_Cancel.setImageResource(R.drawable.no_button);
btnPopUpReject_Cancel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
popUpReject.dismiss();
}
});
popUpReject.showAtLocation(popuplayoutReject, Gravity.CENTER, 0, 0);