當前位置: 首頁>>代碼示例>>Java>>正文


Java DrawableCompat.setHotspotBounds方法代碼示例

本文整理匯總了Java中android.support.v4.graphics.drawable.DrawableCompat.setHotspotBounds方法的典型用法代碼示例。如果您正苦於以下問題:Java DrawableCompat.setHotspotBounds方法的具體用法?Java DrawableCompat.setHotspotBounds怎麽用?Java DrawableCompat.setHotspotBounds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v4.graphics.drawable.DrawableCompat的用法示例。


在下文中一共展示了DrawableCompat.setHotspotBounds方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setFrame

import android.support.v4.graphics.drawable.DrawableCompat; //導入方法依賴的package包/類
protected boolean setFrame(int l, int t, int r, int b) {
    boolean changed = super.setFrame(l, t, r, b);
    Drawable d = getDrawable();
    Drawable bg = getBackground();
    if (!(d == null || bg == null)) {
        int width = getWidth();
        int height = getHeight();
        int halfEdge = Math.max(width, height) / 2;
        int centerX = (width + (getPaddingLeft() - getPaddingRight())) / 2;
        int centerY = (height + (getPaddingTop() - getPaddingBottom())) / 2;
        DrawableCompat.setHotspotBounds(bg, centerX - halfEdge, centerY - halfEdge, centerX + halfEdge, centerY + halfEdge);
    }
    return changed;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:15,代碼來源:ActionMenuPresenter.java

示例2: setHotspotBounds

import android.support.v4.graphics.drawable.DrawableCompat; //導入方法依賴的package包/類
/**
 */
@Override
public void setHotspotBounds(int left, int top, int right, int bottom) {
	DrawableCompat.setHotspotBounds(mDrawable, left, top, right, bottom);
}
 
開發者ID:universum-studios,項目名稱:android_ui,代碼行數:7,代碼來源:DrawableWrapper.java

示例3: setHotspotBounds

import android.support.v4.graphics.drawable.DrawableCompat; //導入方法依賴的package包/類
@Override
public void setHotspotBounds(int left, int top, int right, int bottom) {
  DrawableCompat.setHotspotBounds(mDrawable, left, top, right, bottom);
}
 
開發者ID:commonsguy,項目名稱:cwac-crossport,代碼行數:5,代碼來源:DrawableWrapper.java

示例4: setHotspotBounds

import android.support.v4.graphics.drawable.DrawableCompat; //導入方法依賴的package包/類
public void setHotspotBounds(int left, int top, int right, int bottom) {
    DrawableCompat.setHotspotBounds(this.mDrawable, left, top, right, bottom);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:4,代碼來源:DrawableWrapper.java

示例5: draw

import android.support.v4.graphics.drawable.DrawableCompat; //導入方法依賴的package包/類
public void draw(Canvas c) {
    Rect thumbInsets;
    Rect padding = this.mTempRect;
    int switchLeft = this.mSwitchLeft;
    int switchTop = this.mSwitchTop;
    int switchRight = this.mSwitchRight;
    int switchBottom = this.mSwitchBottom;
    int thumbInitialLeft = switchLeft + getThumbOffset();
    if (this.mThumbDrawable != null) {
        thumbInsets = DrawableUtils.getOpticalBounds(this.mThumbDrawable);
    } else {
        thumbInsets = DrawableUtils.INSETS_NONE;
    }
    if (this.mTrackDrawable != null) {
        this.mTrackDrawable.getPadding(padding);
        thumbInitialLeft += padding.left;
        int trackLeft = switchLeft;
        int trackTop = switchTop;
        int trackRight = switchRight;
        int trackBottom = switchBottom;
        if (thumbInsets != null) {
            if (thumbInsets.left > padding.left) {
                trackLeft += thumbInsets.left - padding.left;
            }
            if (thumbInsets.top > padding.top) {
                trackTop += thumbInsets.top - padding.top;
            }
            if (thumbInsets.right > padding.right) {
                trackRight -= thumbInsets.right - padding.right;
            }
            if (thumbInsets.bottom > padding.bottom) {
                trackBottom -= thumbInsets.bottom - padding.bottom;
            }
        }
        this.mTrackDrawable.setBounds(trackLeft, trackTop, trackRight, trackBottom);
    }
    if (this.mThumbDrawable != null) {
        this.mThumbDrawable.getPadding(padding);
        int thumbLeft = thumbInitialLeft - padding.left;
        int thumbRight = (this.mThumbWidth + thumbInitialLeft) + padding.right;
        this.mThumbDrawable.setBounds(thumbLeft, switchTop, thumbRight, switchBottom);
        Drawable background = getBackground();
        if (background != null) {
            DrawableCompat.setHotspotBounds(background, thumbLeft, switchTop, thumbRight, switchBottom);
        }
    }
    super.draw(c);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:49,代碼來源:SwitchCompat.java

示例6: setHotspotBounds

import android.support.v4.graphics.drawable.DrawableCompat; //導入方法依賴的package包/類
public void setHotspotBounds(int left, int top, int right, int bottom) {
    if (this.mDelegateDrawable != null) {
        DrawableCompat.setHotspotBounds(this.mDelegateDrawable, left, top, right, bottom);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:6,代碼來源:VectorDrawableCommon.java

示例7: setHotspotBounds

import android.support.v4.graphics.drawable.DrawableCompat; //導入方法依賴的package包/類
/**
 * As our DiscreteSeekBar implementation uses a circular drawable on API < 21
 * we want to use the same method to set its bounds as the Ripple's hotspot bounds.
 *
 * @param drawable
 * @param left
 * @param top
 * @param right
 * @param bottom
 */
public static void setHotspotBounds(Drawable drawable, int left, int top, int right, int bottom) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        //We don't want the full size rect, Lollipop ripple would be too big
        int size = (right - left) / 8;
        DrawableCompat.setHotspotBounds(drawable, left + size, top + size, right - size, bottom - size);
    } else {
        drawable.setBounds(left, top, right, bottom);
    }
}
 
開發者ID:DuanJiaNing,項目名稱:Musicoco,代碼行數:20,代碼來源:SeekBarCompat.java


注:本文中的android.support.v4.graphics.drawable.DrawableCompat.setHotspotBounds方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。