2

I wish to have a transluscent background for an activity, so that the previous activity can be seen beneath this activity. Something like a transluscent menu that pops up over a videa being played in the background.

Is this possible? Can you tell me how?

Note:I cannot use the default transluscent theme from android, since I am using my own customised background and theme for my application.

Pls help. Below is my style.xml wherein my_btn and my_list are selectors :

<?xml version="1.0" encoding="utf-8"?>
<resources> 
    <style name="btnstyle" parent="@android:style/Widget.Button">
        <item name="android:textColor">#FFFFFF</item> 
        <item name="android:background">@drawable/my_btn</item>         
    </style>    
    <style name="liststyle" parent="@android:style/Widget.ListView">
        <item name="android:listSelector">@drawable/my_list</item>
    </style> 
    <style name="theme" parent="android:Theme.Translucent"> 
        <item name="android:windowBackground">@drawable/background</item>   
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:buttonStyle">@style/btnstyle</item>
        <item name="android:listViewStyle">@style/liststyle</item>  
    </style>
    </resources>
DonGru
  • 13,532
  • 8
  • 45
  • 55
kiki
  • 13,627
  • 17
  • 49
  • 62
  • It seems like android:windowIsTranslucent may hinder orientation changes on some devices. It certainly did on my Samsung phones. – IgorGanapolsky Sep 06 '12 at 15:11

1 Answers1

8

Apply Translucent theme to your activity in AndroidManifest.xml

<activity android:theme="@android:style/Theme.Translucent">
Denis Palnitsky
  • 18,267
  • 14
  • 46
  • 55
  • Hmmm, I can't do this because I have already applied my own theme customised for all buttons and listviews of my application. Also, I have a specific background image also to be used as background for all my activites. Hence, I cant use the default transluscent theme from android. Any other solution? – kiki Sep 29 '10 at 12:51
  • Try to add true to your theme defenition – Denis Palnitsky Sep 29 '10 at 13:00
  • It doesnt help :( I set the background of my LinearLayout to an image. This background makes the window to remain opaque! Also, when I remove this background for the layouts, the window becomes translucent, yes. But my buttons(with another background) remain opaque! – kiki Oct 01 '10 at 05:35
  • 1
    Create your own transparent background images for LinearLayout and Buttons by setting Opacity in your graphics editor. – Denis Palnitsky Oct 01 '10 at 07:43
  • Hmmm, ok! I will do that. But still, I just wonder if there is no means of doing this in android, i.e setting the opacity of images etc. – kiki Oct 05 '10 at 04:06
  • hey can we set opacity to the activity theme you have mentioned as i wanted its to 30-50% opaque, is it possible? – Sunishtha Singh May 12 '15 at 11:15
  • Sorry, I haven't been working with android for a while and not able to help you with that. – Denis Palnitsky May 13 '15 at 09:09