Material Design列

Android(Lollipop/5.0)Material Design(一) 简单介绍

Android(Lollipop/5.0)Material Design(二) 入门指南

Android(Lollipop/5.0)Material Design(三) 使用Material主题

Android(Lollipop/5.0)Material Design(四) 创建列表和卡片

Android(Lollipop/5.0)Material Design(五) 定义阴影和裁剪View

Android(Lollipop/5.0)Material Design(六) 使用图片

Android(Lollipop/5.0)Material Design(七) 自己定义动画

Android(Lollipop/5.0)Material Design(八) 保持兼容性

官网地址:https://developer.android.com/training/material/drawables.html

下面图片的功能能帮助你在app中实现Material设计:

·图片着色

·颜色提取

·矢量图片

Tint Drawable Resources  为图片资源染色

在Android 5.0(API级别21)及以上,你能够将图片和9-patch定义为掩饰透明度。你能使用颜色资源(如。?android:attr/colorPrimary)或主题属性来给它们上色。通常,你仅仅需创建这些资源一次,且自己主动匹配你的主题为它们上色。

能够为BitmapDrawable和NinePatchDrawable 的对象使用setTint(int tint)进行染色。也能够在xml中定义android:tint和android:tintMode属性。

·关于setTint(int tint)的參数,能够是一个@color/下的属性。也能够是一个xml的selector,selector中的item是使用了数字的,如:

 <selector xmlns:android="http://schemas.android.com/apk/res/android">
   <item android:state_focused="true" android:color="@color/testcolor1"/>
   <item android:state_pressed="true" android:state_enabled="false" android:color="@color/testcolor2" />
   <item android:state_enabled="false" android:color="@color/testcolor3" />
   <item android:color="@color/testcolor5"/>
 </selector>

·关于xml中定义属性。如:

<?xmlversion="1.0"encoding="utf-8"?>

<nine-patchxmlns:android="http://schemas.android.com/apk/res/android"

android:tint="@color/abc_primary_text_material_light"

android:tintMode="src_over"

... >

</nine-patch>

Extract Prominent Colors from an Image  从图片抽取明显的颜色

在api21上的support-v7库中有一个android-support-v7-palette.jar,它可以让你从图片中抽取一些显眼的颜色:

Palette p = Palette.generate(Bitmap bitmap);

·鲜艳的                p.getVibrantColor(int defaultColor);
·鲜艳的黑暗         p.getDarkVibrantColor(int defaultColor);
·鲜艳的明亮         p.getLightVibrantColor(int defaultColor);
·柔和的                p.getMutedColor(int defaultColor);
·柔和的黑暗         p.getDarkMutedColor(int defaultColor);
·柔和的明亮         p.getLightMutedColor(int defaultColor);

Palette.generate(),用于在后台线程中运行,假设在前台线程中创建Palette对象,那么能够使用Palette.generateAsync()。

Create Vector Drawables  创建矢量图片

在Android 5.0(API级别21)及以上 能够创建矢量图片,如以下的样例能够绘制一个心形的矢量图:

<!-- res/drawable/heart.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    <!-- intrinsic size of the drawable -->
    android:height="256dp"
    android:width="256dp"
    <!-- size of the virtual canvas -->
    android:viewportWidth="32"
    android:viewportHeight="32">   <!-- draw a path -->
  <path android:fillColor="#8fff"
      android:pathData="M20.5,9.5
                        c-1.955,0,-3.83,1.268,-4.5,3
                        c-0.67,-1.732,-2.547,-3,-4.5,-3
                        C8.957,9.5,7,11.432,7,14
                        c0,3.53,3.793,6.257,9,11.5
                        c5.207,-5.242,9,-7.97,9,-11.5
                        C25,11.432,23.043,9.5,20.5,9.5z" />
</vector>

矢量图片Android正在使用VectorDrawble与此相对应的对象。path很多其它信息可:http://www.w3.org/TR/SVG11/paths.html#PathData。

Android(Lollipop/5.0) Material Design(六) 使用图像的更多相关文章

  1. Android(Lollipop/5.0) Material Design(六) 自定义动画

    官网地址:https://developer.android.com/intl/zh-tw/training/material/animations.html 动画在Material设计中,为用户与a ...

  2. Android(Lollipop/5.0) Material Design(二) 入门指南

    Material Design系列 Android(Lollipop/5.0)Material Design(一) 简介 Android(Lollipop/5.0)Material Design(二) ...

  3. Android(Lollipop/5.0) Material Design(一) 简单介绍

    Material Design系列 Android(Lollipop/5.0)Material Design(一) 简单介绍 Android(Lollipop/5.0)Material Design( ...

  4. Android(Lollipop/5.0) Material Design(四) 创建列表和卡片

    Material Design系列 Android(Lollipop/5.0)Material Design(一) 简单介绍 Android(Lollipop/5.0)Material Design( ...

  5. Android(Lollipop/5.0) Material Design(一) 简介

    官网地址:https://developer.android.com/intl/zh-tw/design/material/index.html 使用Material Design 需要api21,即 ...

  6. Android最佳实践之Material Design

    Material概述及主题 学习地址:http://developer.android.com/training/material/get-started.html 使用material design ...

  7. [转]Android 5.0——Material Design详解(动画篇)

    Material Design:Google推出的一个全新的设计语言,它的特点就是拟物扁平化. Material Design包含了很多内容,今天跟大家分享一下Material新增的动画: 在Andr ...

  8. Android Lollipop 5.0 经典新特性回顾

    *Tamic 专注移动开发! 更多文章请关注 http://blog.csdn.net/sk719887916 虽然Android已到了7.0 ,但是我们还是不能忘怀视觉革命性改变的5.0,今天回顾下 ...

  9. 《Android进阶之光》--Material Design

    接上篇<Android进阶之光>--Android新特性 No1: 组件: 1)底部工作条-Bottom Sheets 2)卡片-Cards 3)提示框-Dialogs 4)菜单-Menu ...

随机推荐

  1. Echache整合Spring缓存实例讲解(转)

    林炳文Evankaka原创作品.转载请注明出处http://blog.csdn.net/evankaka 摘要:本文主要介绍了EhCache,并通过整合Spring给出了一个使用实例. 一.EhCac ...

  2. Java Swing 树状组件JTree的使用方法(转)

    树中特定的节点可以由 TreePath(封装节点及其所有祖先的对象)标识,或由其显示行(其中显示区域中的每一行都显示一个节点)标识.展开 节点是一个非叶节点(由返回 false 的 TreeModel ...

  3. 基于Velocity开发自己的模板引擎

    Velocity是一个基于java的模板引擎(template engine).它同意不论什么人只简单的使用模板语言(template language)来引用由java代码定义的对象. 当Veloc ...

  4. C++包括头文件&lt;&gt;和&quot;&quot;差额

    #include "book.h" #include<iostream.h> 在刚開始学习都会有这样的迷惑.有的程序用<>.有的却用"" ...

  5. schedule vs scheduleAtFixedRate

    最好的方法是在两者之间区分 timer灵感时间设定过去时间T,scheduleAtFixedRate将从T现在所有的任务中运行,schedule而该任务将只运行从现在开始计时. public clas ...

  6. UVALive 5103 Computer Virus on Planet Pandora Description 一些新兴需求模式的字符串 AC自己主动机

    主题链接:option=com_onlinejudge&Itemid=8&page=show_problem&problem=3104">点击打开链接 题意: ...

  7. [渣译文] SignalR 2.0 系列: SignalR简介

    原文:[渣译文] SignalR 2.0 系列: SignalR简介 英文渣水平,大伙凑合着看吧,并不是逐字翻译的…… 这是微软官方SignalR 2.0教程Getting Started with ...

  8. 黑马day11 脏读数据&amp;解

    数据库: create table account ( id int primary key auto_increment, name varchar(20), money double ); ins ...

  9. 《Linux Device Drivers》第十六章 块设备驱动程序——note

    基本介绍 块设备驱动程序通过主传动固定大小数据的随机访问设备 Linux核心Visual块设备作为基本设备和不同的字符设备类型 Linux块设备驱动程序接口,使块设备最大限度地发挥其效用.一个问题 一 ...

  10. docker 真实---安装基本映像 (一)

    浸泡了几天的官方网站,正确docker有了更好的理解.准备着手建立一个公司的开发和测试环境,包含java.python. 环境介绍 首先说明一下我的环境 2物理server(以后简称为主机) 主机A配 ...