Drawable getPadding - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Drawable getPadding method.

This code example shows how to use the following methods:draw, getMinimumHeight, getMinimumWidth, getPadding, setBounds
        boolean drawBackground = background != null;
        boolean drawText = (text != null) && (textPaint != null);
 
        Rect padding = new Rect();
        if (drawBackground) {
            background.getPadding(padding);
            minWidth = Math.max(minWidth, background.getMinimumWidth());
            minHeight = Math.max(minHeight, background.getMinimumHeight());
        } 
 
        int ascent = 0;
        int descent = 0;
        int measuredTextWidth = 0;
        if (drawText) {
            // Paint.ascent is negative, so negate it. 
            ascent = (int) Math.ceil(-textPaint.ascent());
            descent = (int) Math.ceil(textPaint.descent());
            measuredTextWidth = (int) Math.ceil(textPaint.measureText(text));
        } 
        int textHeight = ascent + descent;

7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:draw, getPadding, setBounds
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:draw, getPadding, setBounds
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getPadding
        return mDrawable.getMinimumHeight();
    } 
 
    @Override 
    public boolean getPadding(Rect padding) {
        return mDrawable.getPadding(padding);
    } 
 
    /** {@inheritDoc} */ 
    public void invalidateDrawable(Drawable who) {
        invalidateSelf();
    } 
 
    /** {@inheritDoc} */ 
    public void scheduleDrawable(Drawable who, Runnable what, long when) {
        scheduleSelf(what, when);
    } 
 
    /** {@inheritDoc} */ 
    public void unscheduleDrawable(Drawable who, Runnable what) {
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:draw, getMinimumHeight, getMinimumWidth, getPadding, setBounds
        boolean drawBackground = background != null;
        boolean drawText = (text != null) && (textPaint != null);
 
        Rect padding = new Rect();
        if (drawBackground) {
            background.getPadding(padding);
            minWidth = Math.max(minWidth, background.getMinimumWidth());
            minHeight = Math.max(minHeight, background.getMinimumHeight());
        } 
 
        int ascent = 0;
        int descent = 0;
        int measuredTextWidth = 0;
        if (drawText) {
            // Paint.ascent is negative, so negate it. 
            ascent = (int) Math.ceil(-textPaint.ascent());
            descent = (int) Math.ceil(textPaint.descent());
            measuredTextWidth = (int) Math.ceil(textPaint.measureText(text));
        } 
        int textHeight = ascent + descent;

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getPadding
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int measuredWidth = resolveSize(50, widthMeasureSpec);
         
        // Get the desired height of the icon menu view (last row of items does 
        // not have a divider below) 
        Rect padding = new Rect();
        mSelectionHighlight.getPadding(padding);
        final int desiredHeight = ((int)mPaint.getTextSize()) + mVerticalPadding
                + padding.top + padding.bottom;
         
        // Maximum possible width and desired height 
        setMeasuredDimension(measuredWidth,
                resolveSize(desiredHeight, heightMeasureSpec));
    } 
 
    /** 
     * If the canvas is null, then only touch calculations are performed to pick the target 
     * candidate. 
     */ 
    @Override 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getPadding
        final Rect rect = mTempRect;
 
        mLeftCapDrawable.getPadding(rect);
        int pLeft = rect.left;
 
        mBottomAnchorDrawable.getPadding(rect);
        int pTop = rect.top;
        int pBottom = rect.bottom;
 
        mRightCapDrawable.getPadding(rect);
        int pRight = rect.right;
 
        padding.set(pLeft, pTop, pRight, pBottom);
 
        return pLeft != 0 && pTop != 0 && pRight != 0 && pBottom != 0;
    } 
 
    @Override 
    public boolean isStateful() { 
        return mLeftCapDrawable.isStateful() || mBottomAnchorDrawable.isStateful() || mRightCapDrawable.isStateful();
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:draw, getPadding, setBounds
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getPadding
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int measuredWidth = resolveSize(50, widthMeasureSpec);
         
        // Get the desired height of the icon menu view (last row of items does 
        // not have a divider below) 
        Rect padding = new Rect();
        mSelectionHighlight.getPadding(padding);
        final int desiredHeight = ((int)mPaint.getTextSize()) + mVerticalPadding
                + padding.top + padding.bottom;
         
        // Maximum possible width and desired height 
        setMeasuredDimension(measuredWidth,
                resolveSize(desiredHeight, heightMeasureSpec));
    } 
 
    /** 
     * If the canvas is null, then only touch calculations are performed to pick the target 
     * candidate. 
     */ 
    @Override 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getPadding
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int measuredWidth = resolveSize(50, widthMeasureSpec);
         
        // Get the desired height of the icon menu view (last row of items does 
        // not have a divider below) 
        Rect padding = new Rect();
        mSelectionHighlight.getPadding(padding);
        final int desiredHeight = ((int)mPaint.getTextSize()) + mVerticalPadding
                + padding.top + padding.bottom;
         
        // Maximum possible width and desired height 
        setMeasuredDimension(measuredWidth,
                resolveSize(desiredHeight, heightMeasureSpec));
    } 
 
    /** 
     * If the canvas is null, then only touch calculations are performed to pick the target 
     * candidate. 
     */ 
    @Override 
6
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Drawable getPadding Questions & Answers:

getPadding Method Overview
Return in padding the insets suggested by this Drawable for placing content inside the drawable's bounds.
See Code Examples for other Android Drawable Methods: