Note that there are some explanatory texts on larger screens.

plurals
  1. POMake alert dialog background transparent
    text
    copied!<p>I am creating an alert dialog on Android Jelly Beans OS. Everything works well but what I want is that instead of the black background of the alert dialog I want a transparent background. I read so many articles and user's question on stackoverflow but none of them is helping me out.</p> <p>Here is my code:</p> <pre><code>AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.CustomAlertDialog); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog1, int which) { gActivityResult = REQUEST_PICK_CONTACT; onResume(); return; } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog1, int which) { return; } }); View view = getLayoutInflater().inflate(R.layout.alert_dialog, null); builder.setTitle(R.string.gender_age); builder.setInverseBackgroundForced(false); builder.setView (view); dialog = builder.create (); </code></pre> <p>Here is my CustomAlertDialog which is defined in res/values/styles.xml</p> <pre><code>&lt;style name="CustomAlertDialog" parent="@android:style/Theme.Dialog"&gt; &lt;!-- All customizations that are NOT specific to a particular API-level can go here. --&gt; &lt;item name="android:windowFrame"&gt;@null&lt;/item&gt; &lt;item name="android:windowIsFloating"&gt;true&lt;/item&gt; &lt;item name="android:windowContentOverlay"&gt;@null&lt;/item&gt; &lt;item name="android:windowAnimationStyle"&gt;@android:style/Animation.Dialog&lt;/item&gt; &lt;item name="android:windowBackground"&gt;@color/transparent_color&lt;/item&gt; &lt;item name="android:windowSoftInputMode"&gt;stateUnspecified|adjustPan&lt;/item&gt; &lt;item name="android:colorBackgroundCacheHint"&gt;@null&lt;/item&gt; &lt;item name="android:gravity"&gt;left&lt;/item&gt; &lt;/style&gt; </code></pre> <p>Here is the color.xml</p> <pre><code>&lt;resources&gt; &lt;color name="transparent_color"&gt;#00000000&lt;/color&gt; &lt;/resources&gt; </code></pre> <p>But it didn't help me.</p> <p>My question: Is this doable? If yes, can you please guide me in the right direction? </p>
 

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