1

How to delete clean space on top dialog?

To display I extends my class SherlockDialogFragment. Maybe try to change the setStyle?

My layout of dialog:

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:padding="10dp" >

<ProgressBar
    android:id="@+id/pbDialog"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_vertical" />

<TextView
    android:id="@+id/tvDialog"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_vertical"
    android:gravity="center_vertical|center_horizontal"
    android:text="text" />

</LinearLayout>

My screen:

screen with spaces

4

3 回答 3

2

在职的:

public void onCreate(Bundle savedInstanceState) {
    ...
    setStyle(DialogFragment.STYLE_NO_FRAME, android.R.style.Theme);
    ...
}
于 2012-07-24T08:48:47.643 回答
0

感谢 Max Bublifoff 的意见。他不会像所说的那样给你任何框架。如果要保留对话框框架,请在 onCreate 中使用它。

    setStyle(DialogFragment.STYLE_NO_TITLE, 0);
于 2013-05-21T19:44:10.153 回答
0

只需使用:

   override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
      requireDialog().requestWindowFeature(Window.FEATURE_NO_TITLE)
      return super.onCreateView(inflater, container, savedInstanceState)
   }
于 2021-07-10T08:13:19.700 回答