Material-dialogs: need transparent background

Created on 30 Jun 2015  路  5Comments  路  Source: afollestad/material-dialogs

When I use the customview does not support transparent

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
                android:background="@color/transparent"
    >
new MaterialDialog.Builder(getActivity())
                    .backgroundColorRes(R.color.transparent)
                    .customView(R.layout.dialog_welcom, false)
                    .show();

You can only see the gray

Most helpful comment

Solution:

MaterialDialog dialog = new MaterialDialog.Builder(getContext()..content(R.string.content).build();

// make dialog itself transparent
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

// remove background dim
dialog.getWindow().setDimAmount(0);
dialog.show();

All 5 comments

You'll need your own dialog theme for this.

This library is designed to simplify dialogs that use Material design.

+1 for dialog transparency

Solution:

MaterialDialog dialog = new MaterialDialog.Builder(getContext()..content(R.string.content).build();

// make dialog itself transparent
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

// remove background dim
dialog.getWindow().setDimAmount(0);
dialog.show();

Hello @ranieripieper i tried as you suggested. It not worked. But if i apply to alert dialog like usual. the background become transparent as well.

Hello @afollestad is there any way to set the header background full of width to a specified color? Please help. Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bahmandamia6982 picture bahmandamia6982  路  6Comments

dabo248 picture dabo248  路  7Comments

palaima picture palaima  路  4Comments

ghost1372 picture ghost1372  路  5Comments

azizimusa picture azizimusa  路  4Comments