To have a transluscent background for an android activity?

ぐ巨炮叔叔 提交于 2019-12-18 18:08:32

问题


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>

回答1:


Apply Translucent theme to your activity in AndroidManifest.xml

<activity android:theme="@android:style/Theme.Translucent">


来源:https://stackoverflow.com/questions/3821624/to-have-a-transluscent-background-for-an-android-activity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!