UPDATE: This answer in Stack Overflow is more complete and correct. You better use that instead of what appears below.
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 :)
Hello every one,
Thank you so much for helping, I have trid to change the background to be transpant and it is working, but could any one help me how can I take x and y velocity on this backgroun when finger touch movement, or as we are using samsung in showing pointer location on the screen.
Thank you.
Suleyman, you should post your question on Stack Overflow ( http://stackoverflow.com/ ). I have no idea how to do what you’re asking.