I wish to make a custom AlertDialog full screen like a new activity screen.
Tried these answers and still not working
- Android make a dialog appear in fullscreen
- Make AlertDialog Custom
- How to make an Alert dialog in full screen in Android?
public void newDialog(final Context c){ final AlertDialog alertDialog; LayoutInflater layoutInflater = LayoutInflater.from(c); dialogueView = layoutInflater.inflate(R.layout.layout_dialogue, null); final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(c); alertDialogBuilder.setView(dialogueView); alertDialog = alertDialogBuilder.create(); dialogueView.findViewById((R.id.closeBtn)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { alertDialog.dismiss(); } }); alertDialog.show(); } layout_dialogue.xml
<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" style="@style/full_screen_dialog" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/frame"> <android.support.design.widget.FloatingActionButton android:id="@+id/closeBtn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/background_sky" android:clickable="true" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" app:srcCompat="@android:drawable/ic_delete" /> </android.support.constraint.ConstraintLayout> style.xml
<style name="full_screen_dialog" parent="@android:style/Theme.Dialog"> <item name="android:windowNoTitle">true</item> <item name="android:windowFullscreen">true</item> <item name="android:windowIsFloating">true</item> </style> I had also tried
android.R.style.Theme_Black_NoTitleBar_Fullscreen ViewGroup.LayoutParams params = getDialog().getWindow().getAttributes(); params.width = WindowManager.LayoutParams.MATCH_PARENT; params.height = WindowManager.LayoutParams.MATCH_PARENT; None of them are working for me. Any suggestion on how to accomplished it?