zoukankan      html  css  js  c++  java
  • android5.x新特性之Tinting

            Android5.X对图形操作上有更多的功能。下面来看看Tinting(着色)

     

               Tinting的使用非常简单,几乎 没什么好说的,只要在xml中配置好tint和tintMode即可。直接看实际例子吧。

    修改activity_main.xml代码如下:

     1 <?xml version="1.0" encoding="utf-8"?>
     2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     3     xmlns:tools="http://schemas.android.com/tools"
     4     android:layout_width="match_parent"
     5     android:layout_height="match_parent"
     6     android:orientation="vertical">
     7 
     8     <ImageView
     9         android:layout_width="wrap_content"
    10         android:layout_height="wrap_content"
    11         android:src="@mipmap/ic_launcher"/>
    12     <ImageView
    13         android:layout_width="wrap_content"
    14         android:layout_height="wrap_content"
    15         android:src="@mipmap/ic_launcher"
    16         android:tint="@android:color/holo_blue_bright"/>
    17     <ImageView
    18         android:layout_width="wrap_content"
    19         android:layout_height="wrap_content"
    20         android:src="@mipmap/ic_launcher"
    21         android:tint="@android:color/holo_blue_bright"
    22         android:tintMode="add"/>
    23     <ImageView
    24         android:layout_width="wrap_content"
    25         android:layout_height="wrap_content"
    26         android:src="@mipmap/ic_launcher"
    27         android:tint="@android:color/holo_blue_bright"
    28         android:tintMode="multiply"/>
    29 
    30     <ImageView
    31         android:layout_width="wrap_content"
    32         android:layout_height="wrap_content"
    33         android:src="@mipmap/ic_launcher"
    34         android:tint="@android:color/holo_blue_bright"
    35         android:tintMode="screen"/>
    36 
    37     <ImageView
    38         android:layout_width="wrap_content"
    39         android:layout_height="wrap_content"
    40         android:src="@mipmap/ic_launcher"
    41         android:tint="@android:color/holo_blue_bright"
    42         android:tintMode="src_atop"/>
    43 
    44     <ImageView
    45         android:layout_width="wrap_content"
    46         android:layout_height="wrap_content"
    47         android:src="@mipmap/ic_launcher"
    48         android:tint="@android:color/holo_blue_bright"
    49         android:tintMode="src_over"/>
    50 
    51     <ImageView
    52         android:layout_width="wrap_content"
    53         android:layout_height="wrap_content"
    54         android:src="@mipmap/ic_launcher"
    55         android:tint="@android:color/holo_blue_bright"
    56         android:tintMode="src_in"/>
    57 </LinearLayout>

             就是将系统的一个亮蓝色用来给图片着色,黄块标注出来的代码就是不同的着色模式。我们看看都是啥样子的效果:

        好像这几种模式也没有显著不同啊。最终出来的效果如上。

  • 相关阅读:
    JVM源码分析之MetaspaceSize和MaxMetaspaceSize的区别
    JSTREE 实现AJAX重载入时刷新所有节点树
    .NET判断是否为AJAX提交
    防止重复提交的思路
    在使用EF时调用DBFUNCTION扩展方法时,发生ENTITYCOMMANDEXECUTIONEXCEPTION 异常的解决办法
    .NET和JAVA中BYTE的区别以及JAVA中“DES/CBC/PKCS5PADDING” 加密解密在.NET中的实现
    .NET中集合已修改;可能无法执行枚举操作 的解决办法
    ASP.NET中将导出的数据以UTF-8编码方式进行存储
    MVC中的BASE.ONACTIONEXECUTING(FILTERCONTEXT) 的作用
    MVC中部分视图调用方法总结
  • 原文地址:https://www.cnblogs.com/fuly550871915/p/5002759.html
Copyright © 2011-2022 走看看