android studio 的神器--bitmap

android studio引入了一个很牛逼的功能

可以直接修改图片文件的颜色!

原本白色的搜索图标


在drawable下新建一个search_icon_green.xml

<?xml version="1.0" encoding="utf-8"?>

<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/ic_search"
    android:tint="@color/green"
    android:tintMode="src_over"
    >

</bitmap>

这样之后,图片的颜色就直接变成了绿色的啦



不过不要太卡开心。需要API21

        Attribute tintMode is only used in API level 21 and higher (current min is 16) less... (Ctrl+F1)

This check finds attributes set in XML files that were introduced in a version newer than the oldest version targeted by your application (with the the minSdkVersion attribute).

This is not an error; the application will simply ignore the attribute. However, if the attribute is important to the appearance of functionality of your application, you should consider finding an alternative way to achieve the same result with only available attributes, and then you can optionally create a copy of the layout in a layout-vNN folder which will be used on API NN or higher where you can take advantage of the newer attribute.

Note: This check does not only apply to attributes. For example, some tags can be unused too, such as the new <tag> element in layouts introduced in API 21.     


  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值