Code example for Drawable

Methods: drawgetBounds

0
            Drawable topDr = drawables[1];
            // IMPORTANT: The coordinates computed are also used in invalidateDrawable() 
            // Make sure to update invalidateDrawable() when changing this code. 
            if (topDr != null) {
                canvas.save();
                canvas.translate(scrollX + compoundPaddingLeft + (hspace - topDr.getBounds().width()) / 2,
                        scrollY + textView.getPaddingTop() + vspace / 2);
                topDr.draw(canvas);
                canvas.restore();
                return true; 
            } 
        } 
 
        return false; 
    } 
 
    public static void applyButtonDef(@Nonnull Button button, @Nonnull ButtonDef buttonDef) {
        button.setText(buttonDef.getText());
 
        final Integer drawableResId = buttonDef.getDrawableResId();
        if ( drawableResId != null ) {