I have a dialog Fragment which look like that.
AlertDialog ad = builder.create();
Drawable d = new ColorDrawable(Color.BLACK);
d.setAlpha(130);
ad.getWindow().setBackgroundDrawable(d);
This code get background semi transparent. But I still got a white part on the bottom. I want to get rid of the white to just have semi transparent background
I already tried a lot of stuff that I saw in other posts.
I don't know what is the object that I must change between the DialogFragment, the AlertDialog and the LinearLayout.
It may not be the LinearLayout, because when I increase margin, nothing is moving.
Here is my code :
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// setStyle(DialogFragment.STYLE_NORMAL, 0);
// setStyle(STYLE_NO_FRAME, R.style.CustomDialog);
// setStyle(STYLE_NO_FRAME, 0);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
View view = getActivity().getLayoutInflater().inflate(
R.layout.share_or_die, null);
AlertDialog ad = builder.create();
Drawable d = new ColorDrawable(Color.BLACK);
d.setAlpha(130);
ad.getWindow().setBackgroundDrawable(d);
ad.setCanceledOnTouchOutside(true);
ad.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
ad.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
return ad;
}
I just call it in the mainActivity when user click back button:
@Override
public void onBackPressed() {
if (isUserConnected && !hasShared) {
shareOnExitDialog = new ShareOnExitDialog();
shareOnExitDialog.setCancelable(true);
shareOnExitDialog.show(getSupportFragmentManager(), "Exit");
} else {
finish();
}
}
Any help would be appreciated !