是否可以在Drawable上应用多个ColorFilters?

时间:2012-07-22 13:10:26

标签: java android

是否可以在Drawable上应用多个ColorFilter,即在drawable上应用第一个ColorFilter然后在mutated drawable上应用第二个?

示例代码:

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View returnView = super.getDropDownView(position, convertView, parent);
    Drawable d = returnView.getBackground();
    d.setColorFilter(0xFFF1F633, PorterDuff.Mode.MULTIPLY);
    // overrides the first color filter
    d.setColorFilter(0xFFEEEEEE, PorterDuff.Mode.LIGHTEN);
    returnView.setBackgroundDrawable(d);
    return returnView;
}

0 个答案:

没有答案