首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >android中的app:tint和android:tint有什么区别?

android中的app:tint和android:tint有什么区别?
EN

Stack Overflow用户
提问于 2020-12-31 13:19:58
回答 1查看 267关注 0票数 1
代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_marginLeft="5dp"
    android:layout_marginRight="5dp"
    android:layout_marginTop="5dp"
    android:elevation="5dp"
    app:cardCornerRadius="5dp">


<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical">

<ImageView
    android:id="@+id/img_delete"
    android:layout_width="20dp"
    android:layout_height="20dp"
    android:layout_margin="7dp"
    android:src="@drawable/ic_remove"
    app:tint="@color/design_default_color_error"
    android:tint="@color/white"
    /> <!-- Setting tints of Image -->


</LinearLayout>
</androidx.cardview.widget.CardView>

这段代码显示了在ImageView中添加色调,我想问一下什么是色调,它的效果是什么,以及我使用的两种色调之间的区别是什么。

EN

回答 1

Stack Overflow用户

发布于 2020-12-31 13:44:22

在这两种情况下,这都会设置图像的着色颜色,但是由于see here的兼容性原因,android:tint有一些问题。此外,它不适用于低于api级别21的版本。所以使用app:tint将是最好的方式。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65516942

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档