Max Bublikoff
Max Bublikoff

Reputation: 1234

SherlockDialogFragment and empty space on dialog

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

Upvotes: 1

Views: 1354

Answers (3)

ItSNeverLate
ItSNeverLate

Reputation: 729

Just use:

   override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
      requireDialog().requestWindowFeature(Window.FEATURE_NO_TITLE)
      return super.onCreateView(inflater, container, savedInstanceState)
   }

Upvotes: 0

moberme
moberme

Reputation: 689

Thank you Max Bublifoff for your input. His will give you no frame as stated. If you want to keep the dialog frame use this in the onCreate.

    setStyle(DialogFragment.STYLE_NO_TITLE, 0);

Upvotes: 0

Max Bublikoff
Max Bublikoff

Reputation: 1234

Working:

public void onCreate(Bundle savedInstanceState) {
    ...
    setStyle(DialogFragment.STYLE_NO_FRAME, android.R.style.Theme);
    ...
}

Upvotes: 2

Related Questions