How to make an Activity's background transparent?

mremremre1 picture mremremre1 · Sep 3, 2013 · Viewed 9.9k times · Source

How can i make an activity appear in the center of the screen like a dialog while the previous activity(the activity that call the intent for the transparent one)
remains visible in the background ? I tried setting gravity as center and background as #00000000 as seen in other answers but it doesnt work as seen in other answers.

Answer

kalyan pvs picture kalyan pvs · Sep 3, 2013

Try to mention your style like this then this will shown as a dialog and transparent..

<style name="DialogTheme" parent="android:Theme.Dialog">

    <!-- No backgrounds, titles or window float -->
    <item name="android:windowBackground">@null</item>
    <item name="android:windowIsTranslucent">true</item>
</style>

In your activity apply theme like this..

 <activity
        android:name="com.afbb.smartlock.activitys.PreviewImagesActivity"
        android:theme="@style/DialogTheme" >
 </activity>