Adding Ok/Cancel buttons to DialogFragment
<p>I have a dialog Fragment and i would like to put the ok/cancel buttons in the bottom of the dialog. I tried but the only thing i got was the buttons over the edit text (that is in the DialogFragment). Thisi is my dialog:
<a href="https://i.stack.imgur.com/piuM2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/piuM2.png" alt="enter image description here"></a></p>

<p>And this is my dialog code:</p>

<pre><code>public class dialogNewFile extends DialogFragment {
private EditText textNewFile;

public dialogNewFile(){}

public static dialogNewFile newIstance(String title){
    dialogNewFile frag=new dialogNewFile();
    Bundle args=new Bundle();
    args.putString("title",title);
    frag.setArguments(args);
    return frag;
}


@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedIstanceState ){
    return inflater.inflate(R.layout.fragment_newfile,container);
}

@Override
public void onViewCreated(View view, @Nullable Bundle savedIstanceState){
    super.onViewCreated(view, savedIstanceState);
    textNewFile=(EditText) view.findViewById(R.id.edit_text_newfile);
    String title=getArguments().getString("title","Enter name");
    getDialog().setTitle(title);
    textNewFile.requestFocus();
    getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}

@Override
public void onResume() {
    Window window = getDialog().getWindow();
    Point size = new Point();
    // Store dimensions of the screen in `size`
    Display display = window.getWindowManager().getDefaultDisplay();
    display.getSize(size);
    // Set the width of the dialog proportional to 75% of the screen width
    window.setLayout((int) (size.x * 0.75), (int) (size.x * 0.50));
    window.setGravity(Gravity.CENTER);
    // Call super onResume after sizing
    super.onResume();

}
</code></pre>

<p>this is the layout of the dialog fragment:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:id="@+id/dialogNewFile"&gt;

&lt;EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="35dp"
    android:hint="@string/hint_new_file"
    android:inputType="text"
    android:id="@+id/edit_text_newfile"/&gt;

&lt;/LinearLayout&gt;
</code></pre>