更改图标的颜色与多种颜色的图标

时间:2017-02-08 10:05:13

标签: android performance android-layout

我很困惑在运行时使用以下方法更改图标的颜色:

Drawable x = getResources().getDrawable(R.drawable.ic_action_xx);
x.setColorFilter(Color.parseColor("#000000"), PorterDuff.Mode.SRC_ATOP);

或在我需要的每种颜色中创建许多图标文件! 任何帮助!谢谢你

2 个答案:

答案 0 :(得分:1)

这取决于图片的数量。如果只有几种颜色(例如白色和黑色),我会为每个创建图像。但对于数百种颜色,我认为使用滤镜更好。

实际上,如果您的应用仅支持SDK版本>棒糖 你可以在xml中使用tint参数。

$(document).ready(function(){
      var width = screen.width,
        height = screen.height;
 
        if (screen.width <= 320 || screen.height <= 176) {
		
		$('#lan').remove();
        }
});

答案 1 :(得分:0)

在此链接后面安装MaterialDesignIconGeneratorPlugin https://github.com/konifar/android-material-design-icon-generator-plugin