I am trying to use a viewpager inside a dialog fragment (a SherlockDialogFragment actually). Every page consists of a text view with a left drawable. The problem i am facing is that the dialog size is 'wrong'. The width is too little, the height too much (it extends from top to bottom). For the width, i have "solved" this problem forcing its minimum width to be 70% of the screen width (via code, in the onCreateView() method of the dialog fragment). For the height, i don't know how to fix it. There is a button down there, but it can't be seen:

The viewpager is working (i can swipe the three pages i have setup). This is the dialog fragment layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/dlg_bkg"
    android:orientation="vertical" >
    <TextView        
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:text="TITLE"
        android:textStyle="bold"
        android:maxLines="1"
        android:drawableLeft="@drawable/icon"
        android:drawablePadding="8dp"
        android:textAppearance="?android:attr/textAppearanceMedium" />
    <View
        android:layout_width="fill_parent"
        android:layout_height="2px"
        android:layout_marginBottom="10dp"
        android:layout_marginTop="10dp"
        android:background="@drawable/lineseparator"
        android:visibility="visible" />
    <android.support.v4.view.ViewPager
        android:id="@+id/welcome_dlg_pager"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
         >
    </android.support.v4.view.ViewPager>
    <View
        android:layout_width="fill_parent"
        android:layout_height="2px"
        android:layout_marginBottom="10dp"
        android:layout_marginTop="10dp"
        android:background="@drawable/lineseparator"
        android:visibility="visible" />
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
     >
        <Button
            android:id="@+id/close_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="0.5"
            android:background="?selectableItemBackground"
            android:minHeight="40dp"
            android:text="Close"
            android:textColor="@android:color/white" />
    </LinearLayout>
</LinearLayout>
This is the example page layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/welcome_dlg_page1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical" >
    <TextView        
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Page 1 - ekrjgwoirhfwiorht2iu3hr2984hr893rhg3hff2jif283hr29837rh283eh23r23r2r23rwrgioehrg803"
        android:drawableLeft="@drawable/img1"
        android:drawablePadding="8dp"
        android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
Why the dialog height is too much? How can i fix it?
 
     
     
    