FEATURE_NO_TITLE works when creating a dialog from scratch, as in:
Dialog dialog = new Dialog(context);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
But it doesn't work when creating an AlertDialog (or using the Builder), because it already disables the title and use a custom one internally.
I have looked at the SDK sources, and I think that it can't be worked around. So to remove the top spacing, the only solution is to create a custom dialog from scratch IMO, by using the Dialog class directly.
Also, one can do that with a style, eg in styles.xml:
<style name="FullHeightDialog" parent="android:style/Theme.Dialog">
<item name="android:windowNoTitle">true</item>
</style>
And then:
Dialog dialog = new Dialog(context, R.style.FullHeightDialog);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…