So I've followed a tutorial on making dialog's and while it works fine, the dialog always has this white background behind it.
You can see it here in the image. I've tried making it transparent and stuff but it doesn't seem to work. I want it so that behind the popup will be the home screen or something else, with the dialog floating on top.
Code for dialog,
You can see it here in the image. I've tried making it transparent and stuff but it doesn't seem to work. I want it so that behind the popup will be the home screen or something else, with the dialog floating on top.
Code for dialog,
Code:
public class AlarmDialogClass extends Activity implements View.OnClickListener {
private AlertDialog.Builder mBuilder;
private AlertDialog mAlertDialog;
private View mDialogView;
private Button mOkBtn, mCancelBtn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LayoutInflater inflater = getLayoutInflater();
// build the dialog
mBuilder = new AlertDialog.Builder(this);
mDialogView = inflater.inflate(R.layout.dialog_layout, null);
mOkBtn = (Button) mDialogView.findViewById(R.id.ok);
mCancelBtn = (Button) mDialogView.findViewById(R.id.cancel);
mOkBtn.setOnClickListener(this);
mCancelBtn.setOnClickListener(this);
mBuilder.setCancelable(false);
mBuilder.setView(mDialogView);
mAlertDialog = mBuilder.create();
mDialogView.setBackground(new ColorDrawable(Color.TRANSPARENT));
mAlertDialog.show();
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.ok:
mAlertDialog.dismiss();
break;
case R.id.cancel:
mAlertDialog.dismiss();
break;
}
}
}