方法一:

通过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. Python环境变量配置问题

    安装Python2.7后,在环境变量中加入路径方法如下: 1,设置:右键单击计算机-->属性-->高级系统设置-->环境变量-->Path-->编辑Path-->在 ...

  2. MapReduce ---- TD-IDF

    1.TF-IDF TF-IDF(term frequency/inverse document frequency) 的概念被公认为信息检索中最重要的发明.描述单个term与特定document的相关 ...

  3. 通过Orchard认识的Autofac

    反射Reflection 这是.Net中获取运行时类型信息的方式,.Net的应用程序由几个部分:'程序集(Assembly)'.'模块(Module)'.'类型(class)'组成,而反射提供一种编程 ...

  4. SQL Server 输出受影响的行

    前期准备: create table Nums(X int); create table T(X int); go 目的:把对表Nums的insert | delete | update 反映到T表中 ...

  5. 重置出错?微软Win10平板Surface Pro 4重装系统教程详解

    重置出错?微软Win10平板Surface Pro 4重装系统教程详解 2015-12-11 15:27:30来源:IT之家作者:凌空责编:凌空 评论:65 Surface Pro 4系统重置出错该怎 ...

  6. Android学习笔记:利用httpclient和AsyncTask 发起网络http post操作

    1.在android4中,发起网络http操作,不能在Activity的事件(即主线程)中进行,必须在单独的线程中操作. 另外进行网络操作,需要在manifest文件中增加如下的权限: <use ...

  7. Exec sql/c

    Exec sql/c 利用高级语言的过程性结构来弥补SQL语言实现复杂应用方面的不足. 嵌入SQL的高级语言称为主语言或宿主语言. 在混合编程中,SQL语句负责操作数据库,高级语言语句负责控制程序流程 ...

  8. Python开发技术详解(视频+源码+文档)

    Python, 是一种面向对象.直译式计算机程序设计语言.Python语法简捷而清晰,具有丰富和强大的类库.它常被昵称为胶水语言,它能够很轻松的把用其他语言制作的各种模块(尤其是C/C++)轻松地联结 ...

  9. npm 常用命令

    npm install xxx 安装模块npm install xxx@1.1.1   安装1.1.1版本的xxxnpm install xxx -g 将模块安装到全局环境中.npm ls 查看安装的 ...

  10. winds引导配置数据文件包含的os项目无效

    我装了winds7与linux双系统,用easyBcd程序时,删除了一个winds7,之后winds7就进不去了, 进入winds7时显示winds未能启动,原因可能是最近更改了硬件或软件.解决此问题 ...