为了有一个半透明背景的机器人活动? [英] To have a transluscent background for an android activity?

查看:149
本文介绍了为了有一个半透明背景的机器人活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望有一个半透明的背景活动,从而使previous活动可以看出,本次活动的下方。就像一个半透明的菜单弹出超过videa正在播放的背景。

这可能吗?你能告诉我怎么样?

注:我无法从Android的使用默认的半透明的主题,因为我用我自己的自定义背景和主题我的应用程序

请帮助。下面是我style.xml其中my_btn的和my_list的选择:

 < XML版本=1.0编码=UTF-8&GT?;
<资源>
    <样式名称=btnstyle父=@安卓风格/ Widget.Button>
        <项目名称=机器人:文字颜色>#FFFFFF< /项目>
        <项目名称=机器人:背景> @可绘制/ my_btn的< /项目>
    < /风格>
    <样式名称=liststyle父=@安卓风格/ Widget.ListView>
        <项目名称=机器人:listSelector> @可绘制/ my_list< /项目>
    < /风格>
    <样式名称=主题为父=机器人:Theme.Translucent>
        <项目名称=机器人:windowBackground> @可绘制/背景< /项目>
        <项目名称=机器人:windowIsTranslucent>真< /项目>
        <项目名称=机器人:按钮样式> @风格/ btnstyle< /项目>
        <项目名称=机器人:listViewStyle> @风格/ liststyle< /项目>
    < /风格>
    < /资源>
 

解决方案

应用半透明主题的活动在AndroidManifest.xml中

 <活动机器人:主题=@安卓风格/ Theme.Translucent>
 

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

这篇关于为了有一个半透明背景的机器人活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆