Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android DialogFragment顶部的白色矩形_Android_Android Studio - Fatal编程技术网

Android DialogFragment顶部的白色矩形

Android DialogFragment顶部的白色矩形,android,android-studio,Android,Android Studio,当使用dialogFragment时,我在片段顶部得到一个空白矩形,但不知道为什么 我应该得到什么 我到底得到了什么 我的对话片段: public class SelectDialogFragment extends DialogFragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInsta

当使用dialogFragment时,我在片段顶部得到一个空白矩形,但不知道为什么

我应该得到什么

我到底得到了什么

我的对话片段:

 public class SelectDialogFragment extends DialogFragment {

            @Override
            public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
            //inflate layout with recycler view
            View v = inflater.inflate(R.layout.select_frag, container, false);
            return v;
        }

}
选择_frag.xml

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:orientation="vertical"
    android:background="#000"
    android:layout_height="wrap_content">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="New Text"
        android:id="@+id/textView" />
</RelativeLayout>

您应该设置没有标题的样式:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setStyle(STYLE_NO_TITLE, 0);
}

此外,您还可以找到更有用的示例

我没有指定任何特定主题。哦,是的,您应该设置
STYLE\u NO\u TITLE
STYLE。不幸的是,白色条仍然存在