要为一个安卓活动拥有一个半透明的背景?[英] To have a transluscent background for an android activity?

本文是小编为大家收集整理的关于要为一个安卓活动拥有一个半透明的背景?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我希望有一个转角的背景进行活动,以便在此活动下面可以看到先前的活动.像翻转菜单的东西,弹出在背景中播放的videa.

这可能吗?你能告诉我如何?

注意:我不能使用来自Android的默认转发主题,因为我正在使用我自己的自定义背景和主题来获取我的应用程序.

pls帮助.下面是我的style.xml,其中my_btn和my_list选择器:

<?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>

推荐答案

将半透明主题应用于androidmanifest.xml

中的活动
<activity android:theme="@android:style/Theme.Translucent">

本文地址:https://www.itbaoku.cn/post/102480.html

问题描述

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>

推荐答案

Apply Translucent theme to your activity in AndroidManifest.xml

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