Remove Android alert dialog empty space at the top

You could try to make your own Dialog with a custom View by using a DialogFragment and set this

dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

Or maybe just try to use a simple Dialog, not an AlertDialog like this

Dialog dialog = new Dialog(theContext);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(yourCustomView);
dialog.show();

  1. Create style for the AlertDialog:
    <style name="AlertDialogCustom" parent="@android:style/Theme.Dialog">
        <item name="android:windowNoTitle">true</item>
        <item name="android:background">#ffffff</item>
        <item name="android:textColorPrimary">#000000</item>
        <item name="android:textColor">@000000</item>
        <item name="android:typeface">monospace</item>
        <item name="android:textSize">12sp</item>
    </style>
  1. Define this style while creating AlertDialog

    AlertDialog.Builder builder = new AlertDialog.Builder(container.getContext(), R.style.AlertDialogCustom);