版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
tint主要是针对图片进行变色,比如有一个条目点击后 右边的小三角行图片变色,获取很常用就是筛选点击后图片变色,使用tint减少了设计师的压力,还有就是我们也少使用图片 这样就减少了apk的大小
<?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"
tools:context=".MainActivity"
android:orientation="vertical"
>
<android.support.v7.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/left_back"
android:layout_marginLeft="50dp"
/>
<android.support.v7.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/left_back"
android:tint="@color/colorPrimary"
android:layout_marginTop="20dp"
android:layout_marginLeft="50dp"
/>
</LinearLayout>
效果:
原始图片: