android5.x新特性之Tinting
2024-10-11 18:07:55
Android5.X对图形操作上有更多的功能。下面来看看Tinting(着色)
Tinting的使用非常简单,几乎 没什么好说的,只要在xml中配置好tint和tintMode即可。直接看实际例子吧。
修改activity_main.xml代码如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"> <ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:tint="@android:color/holo_blue_bright"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:tint="@android:color/holo_blue_bright"
android:tintMode="add"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:tint="@android:color/holo_blue_bright"
android:tintMode="multiply"/> <ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:tint="@android:color/holo_blue_bright"
android:tintMode="screen"/> <ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:tint="@android:color/holo_blue_bright"
android:tintMode="src_atop"/> <ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:tint="@android:color/holo_blue_bright"
android:tintMode="src_over"/> <ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:tint="@android:color/holo_blue_bright"
android:tintMode="src_in"/>
</LinearLayout>
就是将系统的一个亮蓝色用来给图片着色,黄块标注出来的代码就是不同的着色模式。我们看看都是啥样子的效果:
好像这几种模式也没有显著不同啊。最终出来的效果如上。
最新文章
- jsTree 的简单用法--异步加载和刷新数据
- ArcGIS Server发布服务,报错001270
- Java基础知识强化之IO流笔记64:合并流SequenceInputStream
- angularJS中如何写自定义指令
- Shell括号之间的区别
- 报错信息 The jsp:param action must not be used outside the jsp:include, jsp:forward, or jsp:params elements 的原因及解决办法
- 【64】Spring mvc详解
- C语言 汉诺塔问题
- $.ajax ,ajax请求添加请求头,添加Authorization字段
- BZOJ 3097: Hash Killer I
- mac 安装软件
- C#基础知识回顾-- 反射(2)
- MongoDB索引的种类与使用
- java获取取前段页面的参数
- [ActionScript 3.0] 透视投影
- scss-&;父选择器标识符
- php导出内容到txt并自动弹出下载文件
- Fedora桌面系统Idea中的部分中文无法显示解决
- 转:c++ Oracle OCCI 编程
- java算法之冒泡排序