I played with Transparency and fullscreen settings for a few hours.
This is what I found:
- The API Demo does not adequately describe the process of setting up
transparency and translucency.
- For the G1 with SDk1.5, Transparency is a Window setting so it needs
to be set early before you start adding views to the window.
(I found newsgroup postings which set the transparency late. I presume
this worked on SDK1.0+Emulator)

- Setting the activity's theme in the xml to transparent is the
simplest way to achieve this effect.

- Watch out: Translucent and Fullscreen options do not play together
as expected (the status bar is still above your application; only when
the window is not translucent the app is truly fullscreen). If you can
figure out how to create a true Translucent+Fullscreen window, please
let me know!

Setup:
* Setup your translucent colors in colors.xml -
You'll need this to set the windowBackground in the style
<resources>
    <drawable name="transparent_background">#00000000</drawable>
</resources>

Set up your basic style in style.xml -
    <style name="Theme" parent="android:Theme">
    </style>

 <!--  Now define your own Theme, grab default settings from an
android style, or set the items explicitly: ... -->
    <style name="Theme.TranslucentGlass" parent="android:style/
Theme.Translucent.NoTitleBar">
        <item name="android:windowBackground">@drawable/
transparent_background</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowFullscreen">false</item>
       <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowAnimationStyle">@android:style/
Animation.Translucent</item>
     </style>

Add  your translucent theme to your activity:
        <activity android:name=".MySuperActivity" android:theme="@style/
Theme.TranslucentGlass"
        ...
That's it - you do not need to set anything on your layout views.

Other notes:
You can probably set transparency / translucency before you inflate/
create your view by setting flags on the Window object.
Remember to correctly set alpha values on your colors and bitmaps.
You can see the Android themes  in your SDK install:
<android-sdk-1.5_r2> /platforms/android-1.5/data/res/values/themes.xml

To add a blur effect, add the following code before you inflate your
view:
                        final Window w = getWindow();
                        int flag = WindowManager.LayoutParams.FLAG_BLUR_BEHIND;
                        w.setFlags(flag, flag);
                        ... now inflate your view

I doubt the above notes are complete or the whole story - but I hope
they're useful.
Regards,
Ehermit


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to