Can't make the custom DialogFragment transparent over the Fragment Can't make the custom DialogFragment transparent over the Fragment android android

Can't make the custom DialogFragment transparent over the Fragment


Try

getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

in your DialogFragment's onCreateView


Try this (How to I create a 100% custom DialogFragment)this work for dialog

    Dialog dialog = new Dialog(getActivity());    dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);    dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);              // layout to display    dialog.setContentView(R.layout.add_edit);    // set color transpartent    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));    dialog.show();


Set your theme like this worked for me

<style name="MyDialog" parent="Base.Theme.AppCompat.Light.Dialog">    <item name="android:windowBackground">@android:color/transparent</item></style>

And in your dialog fragment set like this

public class Progress extends DialogFragment {int style = DialogFragment.STYLE_NO_TITLE;int theme = R.style.MyDialog;public Progress() {}@Overridepublic void onCreate(@Nullable Bundle savedInstanceState) {    super.onCreate(savedInstanceState);    setStyle(style, theme);}@Overridepublic View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {    return inflater.inflate(R.layout.progress, container, false);}}