Android DialogFragment布局,奇数额外空格

cod*_*ewb 2 layout android dialogfragment

所以在制作一个dialogfragment简单的"有用户选择"弹出窗口之后,我加载它并在布局中看到一些奇怪的额外空白,我不确定是什么导致它并且我一直在困扰我的大脑试图解决它.我稍微修改了xml以更好地显示行为,唯一的区别是我已将3个垂直部分的宽度从"match_parent"更改为"wrap_content",因此我可以使用边框来显示空白的实际大小.这是一张显示问题的图片:

问题

这是我的xml:

<?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:orientation="vertical" >

    <TextView
        android:id="@+id/pictureSourceMainTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/tvborder"
        android:gravity="center"
        android:text="Where would you like to choose\nyour image from?"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <LinearLayout
        android:id="@+id/pictureSourceIVLayout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/tvborder"
        android:weightSum="3" >

        <ImageView
            android:id="@+id/pictureSourceCancelIV"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:src="@drawable/ic_launcher" />

        <ImageView
            android:id="@+id/pictureSourceGalleryIV"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:src="@drawable/ic_launcher" />

        <ImageView
            android:id="@+id/pictureSourceCameraIV"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:src="@drawable/ic_launcher" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/pictureSourceTVLayout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:weightSum="3" >

        <TextView
            android:id="@+id/pictureSourceCancelTV"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="@drawable/tvborder"
            android:gravity="center"
            android:text="Cancel" />

        <TextView
            android:id="@+id/pictureSourceGalleryTV"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:background="@drawable/tvborder"
            android:gravity="center"
            android:text="Gallery" />

        <TextView
            android:id="@+id/pictureSourceCameraTV"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:background="@drawable/tvborder"
            android:gravity="center"
            android:text="Camera" />
    </LinearLayout>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

所以我的问题是:我可以做些什么来删除这个额外的空格?我的xml布局缺少什么吗?我可以每次手动设置宽度的大小,但我更倾向于窗口本身实际上是"wrap_content"

编辑:事实证明调整大小是由标题引起的,有没有办法将标题缩小到适当的大小?

cod*_*ewb 12

罪魁祸首是头衔.设置:

getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); 
Run Code Online (Sandbox Code Playgroud)

oncreateview我的dialogfragment中修复了所有大小的问题,我只是添加了一个新imageview的顶部并在photoshop中设计了我自己的标题.