Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid - Specifying custom theme for custom dialog AlertDialog.Builder wraps content within a dialog
    text
    copied!<p>I created a custom theme that inherits from 'Theme.Holo.Light.Dialog'.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;style name="cust_dialog" parent="@android:style/Theme.Holo.Light.Dialog"&gt; &lt;/style&gt; &lt;/resources&gt; </code></pre> <p>My code:</p> <pre><code>private AlertDialog testDialog; AlertDialog.Builder testBuilder; LayoutInflater inflater = (LayoutInflater)this.getSystemService(LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.test_dialog, (ViewGroup) findViewById(R.id.test_root)); testBuilder = new AlertDialog.Builder(this, R.style.cust_dialog); testBuilder.setView(layout); testBuilder.setTitle("Support"); testDialog = testBuilder.create(); testDialog.show(); </code></pre> <p>This causes my dialog to be within a dialog. How do I fix this?</p> <p>Thanks.</p> <p>EDIT::::</p> <p>This is my test_dialog.xml layout:</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/test_root" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;Button android:id="@+id/test1" android:layout_width="300dp" android:layout_height="75dp" android:text="@string/test" android:gravity="center" /&gt; &lt;Button android:id="@+id/test2" android:layout_width="300dp" android:layout_height="75dp" android:text="@string/test" android:layout_below="@id/test1" android:gravity="center" /&gt; &lt;/RelativeLayout&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload