There is a dialogue fragment, now it is displayed like this: http://i7.5cm.ru/i/aLZ0.png

It is necessary like this:

enter image description here

Two things are not clear:

Why is there a white bar in the dialogue from above, where did it come from and how to remove it?

How to make the width of the layout, without obscuring, and preferably between the items?

ps The dialogue should be called, attention: from the side curtain.

XML dialog:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#2196f3" android:id="@+id/rate_dialog" android:orientation="vertical"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/ok_sure" android:id="@+id/btn_dialog_yes" android:layout_below="@+id/textView" android:layout_toLeftOf="@+id/btn_dialog_no" android:layout_toStartOf="@+id/btn_dialog_no" android:layout_marginRight="25dp" android:layout_marginEnd="25dp" android:layout_marginTop="68dp" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/no_thanks" android:id="@+id/btn_dialog_no" android:layout_marginRight="22dp" android:layout_marginEnd="22dp" android:layout_alignBaseline="@+id/btn_dialog_yes" android:layout_alignBottom="@+id/btn_dialog_yes" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Do you like Power Thesaurus?" android:textColor="#ffffff" android:layout_marginTop="33dp" android:layout_alignParentTop="true" android:layout_alignRight="@+id/btn_dialog_no" android:layout_alignEnd="@+id/btn_dialog_no" android:layout_marginRight="51dp" android:layout_marginEnd="51dp" /> </RelativeLayout> 

Dialog code:

 public class RateAppFragmentDialog extends DialogFragment implements DialogInterface.OnClickListener{ @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.rate_dialog,null); return view; } 

In MainActivity I simply create an instance, and pass it the getSupportFragmentManager() and tag.

    2 answers 2

    This "white bar" is a title.

    To remove the title from the dialog, add the following line to onCreateView ()

     getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); 

    To make the background transparent:

     getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); 

    You can try to place the dialogue between the items by manually calculating where the item begins, and indenting the dialogue.

      You can remove the white strip so

      dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

      If you want to do between items, without obscuring and widening the screen, then you should abandon the dialogue and expand item_view when clicked (or what event do you have there?)