方法一:

通过Theme.Translucent

@android:style/Theme.Translucent
@android:style/Theme.Translucent.NoTitleBar
@android:style/Theme.Translucent.NoTitleBar.Fullscreen

只需要在Manifest中需要透明的Activity内设置theme为以上任意一个就可以了

<activity
android:name="com.vixtel.simulate.MainApp"
android:configChanges="keyboardHidden|orientation"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Translucent.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

方法二:

自定义style,就像自定义Dialog的style一样,在res-values-color.xml中添加透明颜色值:

<?xml version="1.0" encoding="UTF-8"?>
<resources> <color name="transparent">#0000</color> </resources>

在res-values-styles.xml中添加如下:

<style name="myTransparent">
<item name="android:windowBackground">@color/transparent</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item>
</style>

在Manifest中中需要透明的Activity内设置theme为我们自定义的即可

android:theme="@style/myTransparent"

运行程序后,就全透明了,看得见背景下的所有东西可以却都操作无效。

Android设置Activity背景为透明style的更多相关文章

  1. android设置Activity背景色为透明的3种方

    方法一:这种方法比较简单,只有一个步骤,只需要在配置文件中把需要设置为透明的activity的样式设置为 Android:theme="@android:style/Theme.Transl ...

  2. 【Android】Android 设置Activity窗体 不显示标题和全屏显示

    [一]Android 设置Activity窗体 不显示标题 android:theme="@android:style/Theme.NoTitleBar" <activity ...

  3. iOS设置截图背景图片透明

    /** 设置图片背景为透明 */- (UIImage *)imageToTransparent { // 分配内存 const int imageWidth = self.size.width; co ...

  4. Android 代码设置Activity 背景透明

    当指定Activity 样式 Them.Dialog 时候 又不同意用XML 设置 Activity 的背景颜色的时候 用代码 this.getWindow().getDecorView().setB ...

  5. [Bug] 解决透明 Activity 在 Android 6.0 背景不透明

    如何复现 连续启动两个 Activity ,其中 Activity 1 为 不透明 的 Activity Activity 2 为 透明 的 Activity 通常用于引导页面,例如:豌豆夹锁屏引导用 ...

  6. Android 设置Activity样式 透明度

    一.设置Activity透明度有几种方法:1>.在清单文件中配置Activity时声明android:theme="@android:style/Theme.Translucent&q ...

  7. css 设置元素背景为透明

    要设置某一元素的背景为透明,在 chrome .firefox.opera 下是这样的: rgba 中的最后一个参数 0.4 就是想要的透明度,范围在0-1之间. 在 ie 中一般是这样的: filt ...

  8. Android 设置按钮背景透明与半透明_图片背景透明

    Button或者ImageButton的背景设为透明或者半透明 半透明<Button android:background="#e0000000" ... />  透明 ...

  9. Android设置布局背景为白色的三种方法

    一.在xml文件里可以直接设置: android:background="#ffffff" 其他颜色可以看这里;http://blog.csdn.net/yanzi1225627/ ...

随机推荐

  1. Hibernate之总结

    以前做.net,最近做java项目,负责服务端的开发,直接用的jdbc,线程安全问题.缓存同步问题以及连接池什么的,都是手动写,不但麻烦而且容易出错.项目结束,赶快抽时间学了下hibernate,每天 ...

  2. private、 protected、 public、 internal 修饰符的访问权限

    private : 私有成员, 在类的内部才可以访问. protected : 保护成员,该类内部和继承类中可以访问. public : 公共成员,完全公开,没有访问限制. internal: 当前程 ...

  3. Umbraco模型默认属性

    Media Model的属性: umbracoFileumbracoWidthumbracoHeightumbracoBytesumbracoExtension

  4. vs指定QT的工作目录(其它项目也是如此)

    当一个工程依赖第三方动态库时,这时vs编译出来后,运行会提示缺少动态库.解决方法: 项目->属性->调试: 工作目录:指定程序运行时的目录 环境:指定程序运行时的环境变量 我们可以在环境变 ...

  5. WPF:构建应用程序

    原文 http://www.cnblogs.com/free722/archive/2011/11/13/2247455.html WPF相关的项目内容包含在App.Xaml和Window1.xaml ...

  6. poj2608---几个字母映射到同一个数字

    #include <stdio.h> #include <stdlib.h> #include<string.h> ]={,,,,,,,,,,,,,,,,,,,,, ...

  7. #include <iostream>

    1 static_assert 2 std::nothrow 3 std::ref() 4 std::string 1 static_assert 执行编译时断言检查 语法 static_assert ...

  8. 按模板打印word防止并发操作

    /// <summary> /// /// <summary> /// 打印人员备案表 /// </summary> /// <param name=&quo ...

  9. oracle 11g导入导出

    数据的导入 1 将D:\daochu.dmp 中的数据导入 TEST数据库中.   imp system/manager@TEST  file=d:\daochu.dmp    上面可能有点问题,因为 ...

  10. Unity5UGUI 官方教程学习笔记(四)UI Image

    Image Source image:源图片  需要显示的图片 Color:颜色  会与图片进行颜色的混合 Material:材质 Image Type:  Simple   精灵只会延伸到适合Rec ...