Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android PorterDuff.Mode error: PorterDuff cannot be resolved to a variable

Tags:

java

android

I've got a class which extends LinearLayout, can't figure out how to get PorterDuff.Mode working with this piece of code:

this.getBackground().setColorFilter(Color.parseColor("#a7d2e3"), PorterDuff.Mode.DARKEN);

"PorterDuff cannot be resolved to a variable"

I've imported porterduff and from what I can see PorterDuff is a static class. Any ideas?

like image 443
KingFu Avatar asked Mar 28 '13 11:03

KingFu


1 Answers

Add this to your imports, because for some reason, Eclipse doesn't automatically do it for this one:

import android.graphics.PorterDuff;

like image 176
user1032613 Avatar answered Nov 03 '22 09:11

user1032613