I designed a setting dialog layout here:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical" android:padding="10dip"
android:weightSum="1" android:gravity="center">
<LinearLayout android:id="@+id/linearLayout1"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="vertical" android:layout_weight="1">
<TextView android:text="Sound Options:"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content" android:id="@+id/textView1"
android:layout_height="wrap_content"></TextView>
<LinearLayout android:id="@+id/linearLayout2"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:gravity="center_vertical" android:paddingLeft="5dip">
<TextView android:text="Background Sounds:"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content" android:id="@+id/textView2"
android:layout_height="wrap_content"></TextView>
<ToggleButton android:text="ToggleButton" android:id="@+id/butBackgroundSound"
android:layout_height="wrap_content" android:layout_width="wrap_content"></ToggleButton>
</LinearLayout>
<LinearLayout android:id="@+id/linearLayout3"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:gravity="center_vertical" android:paddingLeft="5dip">
<TextView android:text="Effect Sounds:"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content" android:id="@+id/textView2"
android:layout_height="wrap_content"></TextView>
<ToggleButton android:text="ToggleButton" android:id="@+id/butEffectSound"
android:layout_width="wrap_content" android:layout_height="wrap_content"></ToggleButton>
</LinearLayout>
</LinearLayout>
</LinearLayout>
This is the preview of that layout (and it is correct):

However, when inside Dialog, it is like this:

I don’t know why there’s always a blank space at the top, it happens in all my project, then, the dialog is completely ruined in this project. Please help me.
for remove black space try this line in your code of dialog..
and set property
for top two parent layout.. in your case set this property for top two linearlayout.