Android(Lollipop/5.0) Material Design(六) 使用图像
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 从图片抽取明显的颜色
Palette p = Palette.generate(Bitmap bitmap);
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(六) 使用图像的更多相关文章
- Android(Lollipop/5.0) Material Design(六) 自定义动画
官网地址:https://developer.android.com/intl/zh-tw/training/material/animations.html 动画在Material设计中,为用户与a ...
- Android(Lollipop/5.0) Material Design(二) 入门指南
Material Design系列 Android(Lollipop/5.0)Material Design(一) 简介 Android(Lollipop/5.0)Material Design(二) ...
- Android(Lollipop/5.0) Material Design(一) 简单介绍
Material Design系列 Android(Lollipop/5.0)Material Design(一) 简单介绍 Android(Lollipop/5.0)Material Design( ...
- Android(Lollipop/5.0) Material Design(四) 创建列表和卡片
Material Design系列 Android(Lollipop/5.0)Material Design(一) 简单介绍 Android(Lollipop/5.0)Material Design( ...
- Android(Lollipop/5.0) Material Design(一) 简介
官网地址:https://developer.android.com/intl/zh-tw/design/material/index.html 使用Material Design 需要api21,即 ...
- Android最佳实践之Material Design
Material概述及主题 学习地址:http://developer.android.com/training/material/get-started.html 使用material design ...
- [转]Android 5.0——Material Design详解(动画篇)
Material Design:Google推出的一个全新的设计语言,它的特点就是拟物扁平化. Material Design包含了很多内容,今天跟大家分享一下Material新增的动画: 在Andr ...
- Android Lollipop 5.0 经典新特性回顾
*Tamic 专注移动开发! 更多文章请关注 http://blog.csdn.net/sk719887916 虽然Android已到了7.0 ,但是我们还是不能忘怀视觉革命性改变的5.0,今天回顾下 ...
- 《Android进阶之光》--Material Design
接上篇<Android进阶之光>--Android新特性 No1: 组件: 1)底部工作条-Bottom Sheets 2)卡片-Cards 3)提示框-Dialogs 4)菜单-Menu ...
随机推荐
- WinForm 国际化开发一例
1.新建一个WinForm程序(在中文版的Windows下),如下,添加1个Button和1个Label 设置Form1的localizable属性为True(Form1的properties里的De ...
- Sqlserver中Over函数
Over函数不能单独使用,要和分析函数:rank(),dense_rank(),row_number()等一起使用. 其参数:over(partition by columnname1 order ...
- WPF中的三维空间(1)
原文:WPF中的三维空间(1) WPF中可以创建三维几何图形,支持3D对象的应用,支持从3D Max等软件将3D文件obj导入设计中,但是目前还不支持将材质同时导入,这样需要在WPF中对3D对象重新设 ...
- linux 手动安装 oracle(转)
Linux下安装Oracle 11 此为参照CU论坛上的高人写的文章并结合自身环境增加了点细节性的东西 操作系统 CentOS 4.2 2.6.11.8内核 安装准备 下载Oracle11安装包 内存 ...
- 乐在其中设计模式(C#) - 备忘录模式(Memento Pattern)
原文:乐在其中设计模式(C#) - 备忘录模式(Memento Pattern) [索引页][源码下载] 乐在其中设计模式(C#) - 备忘录模式(Memento Pattern) 作者:webabc ...
- WCF基金会
概念: Windows CommunicationFoundation(WCF)是由微软发展的一组数据通信的应用程序开发接口.能够翻译为Windows通讯接口.它是.NET框架的一部分. 简单地说,W ...
- CloudFoundry 中的GoRouter性能測试
之前一直感觉CloudFoundry的GoRouter的性能不靠谱,或者我们的CloudFoundry 部署架构存在问题,想着进行一些压力測试,可是一直苦于没有压力測试的工具.上一周,部门须要出一个測 ...
- SQL Server 2008 新增T-SQL 简写语法
1.定义变量时可以直接赋值 DECLARE @Id int = 5 2.Insert 语句可以一次插入多行数据 INSERT INTO StateList VALUES(@Id, 'WA'), (@I ...
- windows 设置脚本IP
毫无疑问,在windows设置IP非常方便,因为有操作简单,直观的界面.通过图形用户界面设置IP在一般情况下是足够.但是,对于那些谁经常出差,由人产生的转换工作,这样的变化IP无疑耗时且不方便.假设一 ...
- Cocos2dx-3.1.1 冒险01----> 文件夹结构、新项目project创建并执行
windows开发环境:window7.vs2012.python2.7.6 Cocos2d-x 3.1.1的完整文件夹例如以下:比起曾经的2.x的版本号来说分类更规范了 watermark/2/te ...