zoukankan      html  css  js  c++  java
  • Android 透明主题

    转至:https://blog.csdn.net/zhangwenchaochao/article/details/78654128

    Activity采用透明主题有两种方式:

    重要的内容说三遍:
    采用透明主题的Activity一定要继承Activity,不然会崩溃。
    采用透明主题的Activity一定要继承Activity,不然会崩溃。
    采用透明主题的Activity一定要继承Activity,不然会崩溃。

    方法一
    在你的AndroidManifest里的Activity标签里配置透明主题:

    android:theme=”@android:style/Theme.Translucent”
    android:theme=”@android:style/Theme.Translucent.NoTitleBar”
    android:theme=”@android:style/Theme.Translucent.NoTitleBar.Fullscreen”

    第一种保留标题和状态栏,其他为透明色
    第二种保留状态栏,其他为透明色
    第三种全屏透明

    以上三种选一种即可。

    例子
    <activity android:name=".touming1Activity" android:theme="@android:style/Theme.Translucent" />
    1
    2
    这是刚刚进来的界面,没有透明

     

    采用第一种透明模式:

     

    方法二
    自己定义一种样式,然后在AndroidManifest的Activity标签中采用。

    例子
    在value的styles中定义如下style

    <style name="Transparent" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowBackground">@color/transparent</item>
    <item name="android:windowIsTranslucent">true</item>
    </style>
    1
    2
    3
    4
    5
    别忘了在colors里面定义透明色调

    <color name="transparent">#00000000</color>
    1
    然后在AndroidManifest的Activity标签中采用:

    <activity android:name=".touming2Activity" android:theme="@style/Transparent" />
    ---------------------
    作者:时光匠
    来源:CSDN
    原文:https://blog.csdn.net/zhangwenchaochao/article/details/78654128
    版权声明:本文为博主原创文章,转载请附上博文链接!

  • 相关阅读:
    angular4浏览器兼容问题
    angular4组件生命周期
    angular4路由
    CDH 安装配置指南(Tarball方式)
    nginx-1.14.0安装
    redis-3.0.6安装
    CDH安装kafka
    CDH配置JAVA_HOME
    ntp集群时间同步
    VMware联网
  • 原文地址:https://www.cnblogs.com/jdhdevelop/p/11130462.html
Copyright © 2011-2022 走看看