zoukankan      html  css  js  c++  java
  • Material Theme


    Material Theme提供了一下功能:

    1、系统widgets能够设置调色板

    2、系统widgets的触摸反馈

    3、Activity过渡动画


        你能够依据你品牌的色彩来定义Material Theme。能够使用Material Theme的色彩为status bar、action bar着色。參考下图。



    系统Widgets有新的设计和触摸动画,你也能够在自己的应用中自己定义色彩调色板、触摸反馈动画、Activity过渡。


    Material Theme的定义例如以下:

    • @android:style/Theme.Material (dark version)
    • @android:style/Theme.Material.Light (light version)
    • @android:style/Theme.Material.Light.DarkActionBar

    你能够使用一系列的material styles。查看 android.R.style 參考。


    Customize the Color Palette

        自己定义主题的基础颜色以适应你品牌。使用Theme属性自己定义颜色。Theme继承自Material Theme。


    <resources>
      <!-- inherit from the material theme -->
      <style name="AppTheme" parent="android:Theme.Material">
        <!-- Main theme colors -->
        <!--   your app's branding color (for the app bar) -->
        <item name="android:colorPrimary">@color/primary</item>
        <!--   darker variant of colorPrimary (for status bar, contextual app bars) -->
        <item name="android:colorPrimaryDark">@color/primary_dark</item>
        <!--   theme UI controls like checkboxes and text fields -->
        <item name="android:colorAccent">@color/accent</item>
      </style>
    </resources>



    Customize the Status and Navigation Bar


        使用material theme能够简单的自己定制status bar。能够让status bar适应你的产品,这个在iOS中也是能够实现的。能够设置android:statusBarColor属性来设置status bar的颜色。

    前面看到的

    android:colorPrimaryDark

    会默认设置为status bar的颜色。

        java方法中能够使用Window.setStatusBarColor方法改变status bar来改变色彩。

    Theme Individual Views


    XML布局中定义元素能够指定android主题属性

    就是能够为你的views在Theme中声明各种属性的值。


    这一点,说的最基本的是能够改变status bar的颜色,曾经的版本号是不能够的。

    /**
    * @author 张兴业
    *  我的新浪微博:@张兴业TBOW
    */

  • 相关阅读:
    Animation
    Calendar
    ToggleButton
    ASP.NET备份恢复SqlServer数据库
    ConfirmButton
    DropDown
    备份与恢复ACCESS数据库
    PopupControl
    CascadingDropDown
    RoundedCorners
  • 原文地址:https://www.cnblogs.com/jhcelue/p/6883085.html
Copyright © 2011-2022 走看看