Code example for Canvas

Methods: drawLinegetClipBounds

0
                return PixelFormat.OPAQUE;
            } 
 
            @Override 
            public void draw(Canvas canvas) {
                Rect r = canvas.getClipBounds();
                canvas.drawLine(r.left, r.top, r.right, r.top, p);
            } 
        }; 
 
        ColorDrawable color = new ColorDrawable(colorValue);
 
        StateListDrawable stld = new StateListDrawable();
        stld.addState(new int[] { android.R.attr.state_pressed }, color);
        stld.addState(new int[] { android.R.attr.state_enabled }, d);
        return stld;
    } 
 
} 
Contextual code suggestions in your IDE  Get Codota for Java