本文整理匯總了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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
}