android custom dialog background

make theme like this

<style name="ThemeDialogCustom">
<item name="android:windowFrame">@null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:windowBackground">@color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
</style>

dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);

Try...

You can avoid the gray background like this, Here I did get transparent background.

    ........
    Dialog dialog = new Dialog(MainActivity.this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    Window window = dialog.getWindow();
    window.setBackgroundDrawableResource(android.R.color.transparent);
    dialog.setContentView(R.layout.popup_layout);
    Button dialogBtn= (Button) dialog.findViewById(R.id.btn);

    dialogBtn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            //task
        }
    });
    dialog.show();
    .......