Code example for PorterDuffColorFilter

0
        ((ViewGroup) findViewById(R.id.list1).getParent()).setChildrenLayersEnabled(true);
    } 
     
    private void setupList(int listId) {
        final Paint p = new Paint();
        p.setColorFilter(new PorterDuffColorFilter(0xff00ff00, PorterDuff.Mode.MULTIPLY));
 
        final ListView list = (ListView) findViewById(listId);
        list.setAdapter(new SimpleListAdapter(this));
        list.setLayerType(View.LAYER_TYPE_HARDWARE, p);
    } 
 
    private static class SimpleListAdapter extends ArrayAdapter<String> {
        public SimpleListAdapter(Context context) {
            super(context, android.R.layout.simple_list_item_1, DATA_LIST);
        } 
 
        @Override 
        public View getView(int position, View convertView, ViewGroup parent) {
            TextView v = (TextView) super.getView(position, convertView, parent);
            final Resources r = getContext().getResources();