mremremre1
mremremre1

Reputation: 1036

How to make an Activity's background transparent?

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.

Upvotes: 2

Views: 9882

Answers (1)

kalyan pvs
kalyan pvs

Reputation: 14590

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>

Upvotes: 9

Related Questions