zoukankan      html  css  js  c++  java
  • 【起航计划 014】2015 起航计划 Android APIDemo的魔鬼步伐 13 App->Activity->Translucent 半透明Activity Theme.Translucent

    Activity分类示例的最后几个例子是来显示半透明Activity。例子大同小异。实现Activity的半透明效果主要是通过Style和Theme来实现的。

    看看TranslucentActivity 在AndroidManifest.xml中的定义:

            <activity android:name=".app.TranslucentActivity"
                    android:label="@string/activity_translucent"
                    android:theme="@style/Theme.Translucent">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.SAMPLE_CODE" />
                </intent-filter>
            </activity>

    它使用了Theme.Translucent 主题,这个主题定义在res/styles.xml:

        <!-- A theme that has a translucent background.  Here we explicitly specify
             that this theme is to inherit from the system's translucent theme,
             which sets up various attributes correctly. -->
        <style name="Theme.Translucent" parent="android:style/Theme.Translucent">
            <item name="android:windowBackground">@drawable/translucent_background</item>
            <item name="android:windowNoTitle">true</item>
            <item name="android:colorForeground">#fff</item>
        </style>

    它通过继承系统主题android:style/Theme.Translucent,然后加以修改。@drawable /translucent_background定义在Colors.xml中,颜色值为#e0000000 ,alpha值,也就是透明度为#e0(半透明)。

  • 相关阅读:
    Petapoco 数据库操作类
    .net Cookie操作公共方法 CookieHelper
    .net 服务端缓存 Cache/CacheHelper
    Base64加密解密方法
    对多字段进行去重 ( Linq 方式 )
    BootStrap之 提示工具(Tooltip)插件
    bootstrap之弹出框
    Jquery 强大的表单验证操作
    强大的数据库工具 dbForge Studio ForMySql
    My操作小技巧
  • 原文地址:https://www.cnblogs.com/dongdong230/p/4312960.html
Copyright © 2011-2022 走看看