• 3.21android变脸主题(Theme)实现


    原理图:

     绘图1

    代码:

    color.xml

    <?xml version="1.0" encoding="utf-8"?>

    <resources>

      <drawable name="transparent_background">#0000FF</drawable>

      <drawable name="translucent_background">#C2CE99</drawable>

      <drawable name="blue">#0000FF</drawable>

      <drawable name="white">#FFFFFF</drawable>

      <drawable name="pink">#FFC8FF</drawable>

      <drawable name="darkgreen">#008800</drawable>

    </resources>

    style.xml.

    <?xml version="1.0" encoding="utf-8"?>

    <resources>

      <!-- 基础应用程序主题,为默认主题 -->

      <style name="Theme" parent="android:Theme">

      </style>

     

      <!--

         变更应用程序的主题,使之具有translucent背景

      -->

      <style name="Theme.Translucent">

     

        <item name="android:windowBackground">

        @drawable/translucent_background

        </item>

       

        <item name="android:windowNoTitle">false</item>

        <item name="android:colorForeground">@drawable/blue</item>

        <item name="android:colorBackground">@drawable/white</item>

      </style>

     

      <!--

         变更应用程序的主题,使之具有不同颜色背景且具有translucent背景

      -->

      <style name="Theme.Translucent2">

     

        <item name="android:windowBackground">

        @drawable/pink

        </item>

       

        <item name="android:windowNoTitle">false</item>

        <item name="android:colorForeground">@drawable/darkgreen</item>

        <item name="android:colorBackground">@drawable/pink</item>

      </style>

     

      <!--

         变更应用程序的主题,使之具有透明transparent背景

      -->

      <style name="Theme.Transparent">

       

        <item name="android:windowBackground">

        @drawable/transparent_background

        </item>

       

        <item name="android:windowNoTitle">true</item>

        <item name="android:colorForeground">@drawable/blue</item>

        <item name="android:colorBackground">@drawable/pink</item>

      </style>

     

      <style name="TextAppearance.Theme.PlainText"

           parent="android:TextAppearance.Theme">

        <item name="android:textStyle">normal</item>

      </style>

    </resources>

     

  • 相关阅读:
    Codeforces #250 (Div. 2) B. The Child and Set
    linux下又一次定位svn url方法
    查看hive版本号
    好947 Mybatis 配置resultMap 带參数查询Map 注意selectOne数据库返回结果一条数据库 否则会报错
    csdn加入暂时会话功能
    第二十五天 慵懒的投射在JDBC上的暖阳 —Hibernate的使用(四)
    lzma 知识点滴
    golang 登录
    docker入门
    创建和管理表(10)
  • 原文地址:https://www.cnblogs.com/xilifeng/p/2645061.html
Copyright © 2020-2023  润新知