1.在values下colors中设置透明颜色

<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="transparent">#64000000</color>
</resources>

  

2.在style中引入该color

 </style>
    <style name="Transparent">
  
  <item name="android:windowBackground">@color/transparent</item>
  
  <item name="android:windowIsTranslucent">true</item>
  
 
  
  </style>

  

3.在清单文件中对应的Activity中添加该样式的主题

 <application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SecondActivity" android:theme="@style/Transparent"> </activity>
</application>

  

UI---设置Activity背景为透明的更多相关文章

  1. Android设置Activity背景为透明style

    方法一: 通过Theme.Translucent @android:style/Theme.Translucent @android:style/Theme.Translucent.NoTitleBa ...

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

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

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

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

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

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

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

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

  6. 关于anroid设置webview背景方法探讨(转)

    最近的项目中一直关于webView设置背景色问题在研究,最终找到了解决的方法. 基于我项目的需求,从服务端传过来的是带有标签的文本,如果使用textView会让整个布局显得很乱,里面的<img ...

  7. QT模态对话框用法(在UI文件中设置Widget背景图,这个图是一个带阴影边框的图片——酷)

    QT弹出模态对话框做法: 1.新建UI文件时,一定要选择基类是QDialog的,我的选择是:Dialog without Buttons(),如下图: 2.然后在使用的时候: MyDialog dlg ...

  8. 设置UITableView背景透明/监听cell左边的删除按钮的点击事件

    _tableView = [[UITableView alloc] init]; _tableView.delegate = self; _tableView.dataSource = self; _ ...

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

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

随机推荐

  1. 机器学习---感知机(Machine Learning Perceptron)

    感知机(perceptron)是一种线性分类模型,通常用于二分类问题.感知机由Rosenblatt在1957年提出,是神经网络和支持向量机的基础.通过修改损失函数,它可以发展成支持向量机:通过多层堆叠 ...

  2. KEIL之工程单独文件属性修改

    @2019-04-29 [小记] 可以设置文件是否参与编译.内存分配.宏定义等属性设置

  3. Redis主从配置和哨兵监控配置——服务器端环境搭建

    一:介绍 公司用到的redis框架,主要分为cluster的缓存集群和sentinel中的哨兵主从.这种的选用方式一般需要更具业务场景来做区分,两种框架的配置图为:右图为哨兵主从框架和cliuster ...

  4. Spring Boot学习总结三

    1,mybatis在spring boot下的2种使用模式 无配置文件注解版 application.properties添加相关配置 mybatis.type-aliases-package=com ...

  5. 谈谈JavaScript中继承方式

    聊一聊js中的继承 一.简单继承---使用原型赋值的方式继承,将实例化的对象,赋值给子级的原型 父级构造函数 function Parent(param) { this.name = 'parent' ...

  6. 自定义 ThreadPoolExecutor 处理线程运行时异常

    自定义 ThreadPoolExecutor 处理线程运行时异常 最近看完了ElasticSearch线程池模块的源码,感触颇深,然后也自不量力地借鉴ES的 EsThreadPoolExecutor ...

  7. Asp.net core 3.0

    序言 我的看法:如果你未来五到十年还打算靠 ASP.NET 吃饭,ASP.NET MVC 一定要学,写 WebForm 工作机会将变得很少,具备 MVC 技能才有本钱跟年轻小伙子们抢饭碗,很高比例的 ...

  8. python3 练手实例7 斐波那契数列

    '''a,b=0,1 x=int(input('请指定需要多少项:')) while x>0: print(b) a,b=b,a+b x-=1''' #递归 def fibo(n): if n& ...

  9. ccf 201503-5 最小花费 这题交上去只有10分嗨!求大佬的题解啊

    问题描述 C国共有n个城市.有n-1条双向道路,每条道路连接两个城市,任意两个城市之间能互相到达.小R来到C国旅行,他共规划了m条旅行的路线,第i条旅行路线的起点是si,终点是ti.在旅行过程中,小R ...

  10. C#解压文件,Excel操作

    /// <summary> /// 获取目录下文件路径 /// </summary> /// <param name="path"></p ...