zoukankan      html  css  js  c++  java
  • Android 设置透明Activity

    关于Android设置Activity透明的方法有很多;这里介绍一种最简单的

    1。在MainActivity中放一个按钮;单击按钮是弹出透明的Activity

    2。透明的Activity只要在AndroidMainfest.xml中配置内加上

      android:theme="@android:style/Theme.Translucent" 

    即可设置成透明的Activity

    MainActivity代码很简单;只有一个按钮;单击按钮是弹出透明的Activity;

    透明Activity的布局文件如下: 在上面只放置了一个 ProgressBar

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent" 
        android:background="#9000" 
        >
        <!-- android:background="#9000" :透明颜色 -->
        
    	<ProgressBar 
    	    android:id="@+id/progress"
    	    android:layout_width="wrap_content"
    	    android:layout_height="wrap_content"
    	    android:layout_centerInParent="true"
    	    style="@android:attr/progressBarStyleLarge"
    	    />
     
        
    </RelativeLayout>
    

     AndroidMainfest.xml设置

    <activity android:name="com.zhoucj.translucentactiivity.TranActivity"
                android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
                 />

    运行效果:

  • 相关阅读:
    手机APP远程空气质量监测应用
    SPI
    2017-10-14
    常量声明
    ios- nil NULL 和 NSNull
    Xcode搭建真机调试环境 图文实例
    ios notification
    集合对象总结
    集合对象(NSSet,NSMutableSet,NSIndexSet)
    词典对象(NSDictionary和NSMutableDictionary)
  • 原文地址:https://www.cnblogs.com/zhoujian315/p/3272025.html
Copyright © 2011-2022 走看看