title: How do I change the shape of a dialog?
body: <p>In my app I use many dialogs (popups) and I want to give them a rounded corner shape.</p>
  
  <p>The way I create these popups is this:</p>
  
  <p>On java code I create a function like this:</p>
  
  <pre><code>private void showpopup(){
  
     dialog = new Dialog(this);
     dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
     dialog.setContentView(getLayoutInflater().inflate(R.layout.popup, null));
     dialog.setCancelable(false);
  
  
  
      TextView fin = (TextView) dialog.findViewById(R.id.solu);
      fin.setText("¡¡safsfasfsafs!!");  
  
  
     fin.setOnClickListener(new OnClickListener() {
             public void onClick(View v) {
                 dialog.dismiss();
                 }
  
     });   
    dialog.show();
  }
  </code></pre>
  
  <p>The layout I call there is created in this way:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:gravity="center"
    &gt;
  
      &lt;LinearLayout
          android:id="@+id/linearLayout1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
            android:background="@drawable/shape"
          android:orientation="vertical"
          android:padding="10dp" 
          &gt;
  
  
  &lt;TextView
      android:id="@+id/solu"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textSize="25sp"
      android:padding="10dp"
      android:textAppearance="?android:attr/textAppearanceLarge" /&gt;
    &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>and finally, the xml "shape" that I call in the background is this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;shape xmlns:android="http://schemas.android.com/apk/res/android"
  android:shape="rectangle" &gt;
  
  &lt;corners android:radius="20dp"/&gt;
  
  &lt;stroke
  android:width="1dp"
  android:color="@color/black"/&gt;
  
  &lt;/shape&gt;
  </code></pre>
  
  <p>The result it's something like this:</p>
  
  <p><a href="https://i.stack.imgur.com/HJYPy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HJYPym.png" alt="enter image description here"></a></p>
  
  <p>As you can see, I don't achieve what I want...</p>