【发布时间】:2015-01-28 19:35:03
【问题描述】:
我正在尝试获得像新的 Google Play 报亭应用一样的半透明和彩色图像,但到目前为止我尝试的所有方法都无法完美运行。下面的图片更能说明我的意思。
Google Play 报亭标题如下所示:
但我的代码在我看来是这样的标题:
太可怕了!
我的代码是:
ImageUtils.getImageFiltered(this, R.drawable.disaster, R.color.transparent_teal)
在“ImageUtils”类中,方法getImageFiltered(...)是:
public static Drawable getImageFiltered(Context context, int res, int color) {
Drawable drawable = createContrast(context, res, 50);
color = context.getResources().getColor(color);
ColorFilter filter = new PorterDuffColorFilter(color, PorterDuff.Mode.DARKEN);
drawable.setColorFilter(filter);
return drawable;
}
createContrast(context, res, 50); 方法只是将图像改为黑白。
那么,有谁知道如何获得像 Google 应用一样的图像?
非常感谢,对不起我的英语,我刚刚学习。
【问题讨论】:
-
你应该用你正在使用的语言进行标记 - 这样它更有可能被可以提供帮助的人看到。
-
@JamesWaddington - 我已重新标记帖子并嵌入图片以改进帖子。
-
谢谢@JamesWaddington。我没有添加图像,因为我还不能。我是 Stack Overflow 的新手。
标签: java android image-processing transparency translucency