Full Screen DialogFragment in Android

I’m trying to show an almost fullscreen DialogFragment. But I’m somehow not able to do so. The way I am showing the Fragment is straight from the android developer documentation FragmentManager f = ((Activity)getContext()).getFragmentManager(); FragmentTransaction ft = f.beginTransaction(); Fragment prev = f.findFragmentByTag(“dialog”); if (prev != null) { ft.remove(prev); } ft.addToBackStack(null); // Create and show the … Read more

How to set DialogFragment’s width and height?

Let’s say I specify the layout of my DialogFragment in an xml layout file named my_dialog_fragment.xml and I specify the layout_width and layout_height values of its root view to a fixed value (e.g. 100dp). I then inflate this layout in my DialogFragment‘s onCreateView(…) method as follows: View view = inflater.inflate(R.layout.my_dialog_fragment, container, false); Sadly, I find … Read more

How to create a DialogFragment without title?

I’m creating a DialogFragment to show some help messages regarding my app. Everything works fine besides one thing: There is a black stripe at the top of the window that shows the DialogFragment, that I presume is reserved for the title, something I don’t want to use. This is specially painful since my custom DialogFragment … Read more

How to create a Custom Dialog box in android?

I want to create a custom dialog box like below I have tried the following things. I created a subclass of AlertDialog.Builder and used a custom Title and Custom Content View and used that but the result was not as expected. Another attempt was to subclass DialogFragment and customize the dialog inside onCreateDialog that but … Read more

How to prevent a dialog from closing when a button is clicked

I have a dialog with EditText for input. When I click the “yes” button on dialog, it will validate the input and then close the dialog. However, if the input is wrong, I want to remain in the same dialog. Every time no matter what the input is, the dialog should be automatically closed when … Read more