Question

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.

Was it helpful?

Solution

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top