How to make transparent activity in android?

Step one:

Open the style xml file in res/values/styles.xml.

Step two:

past bellow code in the xml file you opend.

<pre class="default prettyprint prettyprinted"><code><span class="pun"><?</span><span class="pln">xml version</span><span class="pun">=</span><span class="str">"1.0"</span><span class="pln"> encoding</span><span class="pun">=</span><span class="str">"utf-8"</span><span class="pun">?></span>
<span class="tag"><resources></span>
  <span class="tag"><style</span> <span class="atn">name</span><span class="pun">=</span><span class="atv">"Theme.Transparent"</span> <span class="atn">parent</span><span class="pun">=</span><span class="atv">"android:Theme"</span><span class="tag">></span>
    <span class="pun"><</span><span class="pln">item name</span><span class="pun">=</span><span class="str">"android:windowIsTranslucent"</span><span class="pun">></span><span class="pln">true</span><span class="pun"></</span><span class="pln">item</span><span class="pun">></span>
    <span class="pun"><</span><span class="pln">item name</span><span class="pun">=</span><span class="str">"android:windowBackground"</span><span class="pun">>@</span><span class="kwd">android</span><span class="pun">:</span><span class="pln">color</span><span class="pun">/</span><span class="pln">transparent</span><span class="pun"></</span><span class="pln">item</span><span class="pun">></span>
    <span class="pun"><</span><span class="pln">item name</span><span class="pun">=</span><span class="str">"android:windowContentOverlay"</span><span class="pun">>@</span><span class="pln">null</span><span class="pun"></</span><span class="pln">item</span><span class="pun">></span>
    <span class="pun"><</span><span class="pln">item name</span><span class="pun">=</span><span class="str">"android:windowNoTitle"</span><span class="pun">></span><span class="pln">true</span><span class="pun"></</span><span class="pln">item</span><span class="pun">></span>
    <span class="pun"><</span><span class="pln">item name</span><span class="pun">=</span><span class="str">"android:windowIsFloating"</span><span class="pun">></span><span class="pln">true</span><span class="pun"></</span><span class="pln">item</span><span class="pun">></span>
    <span class="pun"><</span><span class="pln">item name</span><span class="pun">=</span><span class="str">"android:backgroundDimEnabled"</span><span class="pun">></span><span class="pln">false</span><span class="pun"></</span><span class="pln">item</span><span class="pun">></span>
  <span class="tag"></style></span>
<span class="tag"></resources></span></code></pre>

Step three:

Then apply the style to your activity

<pre class="default prettyprint prettyprinted"><code><span class="tag"><activity</span> <span class="atn">android:name</span><span class="pun">=</span><span class="atv">".SampleActivity"</span> <span class="atn">android:theme</span><span class="pun">=</span><span class="atv">"@style/Theme.Transparent"</span><span class="tag">></span><span class="pln">
...
</span><span class="tag"></activity></span></code></pre>
It's only fair to share...Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInEmail this to someoneBuffer this pageDigg thisFlattr the authorShare on StumbleUponPin on PinterestShare on YummlyShare on VKShare on RedditPrint this pageShare on Tumblr
Related Posts

Add a Comment

Your email address will not be published. Required fields are marked *