Remove additional property from the top of the custom dialog

I created a custom dialog in which I dynamically insert views through a RelativeLayout. Each time a dialog is displayed, it shows all of my child views just fine, but it has a place at the top that I cannot take into account. I assume that this is reserved for the "name" of the dialog box (which I will not have). Is there a way to remove this space and set up my own dialog only for the content of the content that I am inserting?

here is the xml for the layout:

<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content">
  <RelativeLayout
     android:id="@+id/handlay"
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" />  
</LinearLayout>

by the way, I tried only to have a relative layout of the parent node with the same results.

Here is the .java user dialog.

public class HandResults extends Dialog implements DialogInterface {
    HandResults hr;
    Timer myTimer;
    RelativeLayout handrl;


    // constructor sets the layout view to handresult layout
    public HandResults(Context context) {
        super(context);
        setContentView(R.layout.handresults);
        hr = this;

    }

    // create a timer to remove the dialog after 3 seconds
    public void showHands(){
        this.show();
        myTimer = null;
        myTimer = new Timer();
        myTimer.schedule(new TimerTask() {
            @Override
            public void run() {
                hr.cancel(); 
            }
        }, 3000);

    }
}

and here is what I would call the dialogue:

HandResults mhr = new HandResults(this);
mhr.showHands();

, , , ?

+3
1

conttructor onCreate():

    requestWindowFeature(Window.FEATURE_NO_TITLE);

setContentView.

+18

Source: https://habr.com/ru/post/1761000/


All Articles