首页 技术 正文
技术 2022年11月15日
0 收藏 461 点赞 3,166 浏览 2701 个字

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。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,501
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,915
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,748
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,505
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,143
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,306