zoukankan      html  css  js  c++  java
  • 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>

     

  • 相关阅读:
    小工具合集使用体验
    php计算金额精度丢失问题与二维数组排序
    layui treeSelect
    thinkphp5.1 使用小记
    thinkphp软删除
    移动端meta标签设置
    (kotlin异常) java.lang.NoSuchFieldError: No static field xxx of type I in class Lcom/XX/R$id; or its superclasses
    微信小程序map地图的一些使用注意事项
    修改UIScrollView 的手势代理
    awk命令详解
  • 原文地址:https://www.cnblogs.com/xilifeng/p/2645061.html
Copyright © 2011-2022 走看看