Creating A Transparent Activity In Android
If you want to create a transparent activity in your Android app, add the following style In your res/values/styles.xml file (if you don’t have one, create it.) Here’s a complete file:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Transparent" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
</resources>
(the value @color/transparent is the color value #00000000)
Then apply the style to your activity, for example:
<activity android:name=".SampleActivity" android:theme="@style/Theme.Transparent">
...
</activity>
Thanks to Mathias DESLOGES (aka FreakDev) for his posts on this thread in anddev.org.
Shameless plug: If you’re an Android user, check out my app, Dindy.
Where did you use it? In the widget?
Funny – the shameless plug :)
Android shortcuts can only start an activity, not a service. So if you want a shortcut that starts a service (like the upcoming Dindy shortcuts) you need to have a transparent activity that the user will not see when he/she starts the shortcut.
I put it here because it was hard to find the correct way to do it. If you look for “transparent activity android” in Google you find many ways that work on the emulator but not on some phones or vice versa.
Sababa. 10x.
Thanks a zillion!!!!!!
My pleasure :)