Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: DialogFragment wrap content width when hiding default border
    primarykey
    data
    text
    <p>I have a custom dialog view I am displaying with rounded corners. Because of this I need to hide default Dialog border frame which I am successfully doing with, getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(0));.</p> <p>My problem is the dialog now extends the whole parent width where I only want it to display roughly 90% of the width like a normal dialog window. I've tried setting getWindow().setLayout(...) and also setting layout param attributes but no avail. Any help is much appreciated.</p> <p>*UPDATE. removing getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(0)); from my code fixes the width issue but brings me back to the problem of that default dialog border showing. Though because my custom dialog has no borders and rounded corners I need that border gone without losing that 90% or whatever dialog width like most dialogs.</p> <pre><code>public final class ResetPasswordDialogFragment extends DialogFragment { public static ResetPasswordDialogFragment newInstance() { ResetPasswordDialogFragment f = new ResetPasswordDialogFragment(); Bundle args = new Bundle(); f.setArguments(args); return f; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.dialog_fragment_password_reminder, container, false); //Removes the default dialog background border getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(0)); Button resetBtn = (Button)v.findViewById(R.id.resetPasswordBtn); Button closeBtn = (Button)v.findViewById(R.id.closeBtn); //Click Listeners resetBtn.setOnClickListener(new OnClickListener() { public void onClick(View v) { //TODO web call here } }); closeBtn.setOnClickListener(new OnClickListener() { public void onClick(View v) { dismiss(); } }); return v; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload