本文整理了Java中android.widget.Button.onDraw()
方法的一些代码示例,展示了Button.onDraw()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.onDraw()
方法的具体详情如下:
包路径:android.widget.Button
类名称:Button
方法名:onDraw
暂无
代码示例来源:origin: qiujuer/Genius-Android
@Override
protected synchronized void onDraw(Canvas canvas) {
final TouchEffectDrawable d = mTouchDrawable;
if (d != null) {
d.draw(canvas);
}
super.onDraw(canvas);
}
代码示例来源:origin: facebook/facebook-android-sdk
@Override
protected void onDraw(Canvas canvas) {
boolean centered = (this.getGravity() & Gravity.CENTER_HORIZONTAL) != 0;
if (centered) {
// if the text is centered, we need to adjust the frame for the titleLabel based on the
// size of the text in order to keep the text centered in the button without adding
// extra blank space to the right when unnecessary
// 1. the text fits centered within the button without colliding with the image
// (imagePaddingWidth)
// 2. the text would run into the image, so adjust the insets to effectively left align
// it (textPaddingWidth)
final int compoundPaddingLeft = getCompoundPaddingLeft();
final int compoundPaddingRight = getCompoundPaddingRight();
final int compoundDrawablePadding = getCompoundDrawablePadding();
final int textX = compoundPaddingLeft + compoundDrawablePadding;
final int textContentWidth = getWidth() - textX - compoundPaddingRight;
final int textWidth = measureTextWidth(getText().toString());
final int textPaddingWidth = (textContentWidth - textWidth) / 2;
final int imagePaddingWidth = (compoundPaddingLeft - getPaddingLeft()) / 2;
final int inset = Math.min(textPaddingWidth, imagePaddingWidth);
this.overrideCompoundPaddingLeft = compoundPaddingLeft - inset;
this.overrideCompoundPaddingRight = compoundPaddingRight + inset;
this.overrideCompoundPadding = true;
}
super.onDraw(canvas);
this.overrideCompoundPadding = false;
}
代码示例来源:origin: DaxiaK/MyDiary
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
}
代码示例来源:origin: lygttpod/AndroidCustomView
@Override
protected void onDraw(Canvas canvas) {
if (isLoading) {
drawLoading(canvas, mLoadingIndex);
mLoadingIndex = (mLoadingIndex + 1) % 3;
postDelayed(mRunnable, duration);
} else {
super.onDraw(canvas);
}
}
代码示例来源:origin: kot32go/KSimpleLibrary
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
autoFitTextSize();
}
代码示例来源:origin: AlexZhuo/SensorMonitor
@Override
public void onDraw(Canvas canvas) {
if (shimmerViewHelper != null) {
shimmerViewHelper.onDraw();
}
super.onDraw(canvas);
}
}
代码示例来源:origin: neopixl/PixlUI
@Override
protected void onDraw(Canvas canvas) {
PixlUIfaceManager.onDrawHelper(canvas, this, drawCallback);
super.onDraw(canvas);
}
代码示例来源:origin: 18Gray/ProCamera
@Override
protected void onDraw(final Canvas canvas)
{
super.onDraw(canvas);
if (isInEditMode())
{
return;
}
canvas.save(Canvas.CLIP_SAVE_FLAG);
mPath.reset();
mPath.addCircle(mDownX, mDownY, mRadius, Path.Direction.CW);
canvas.clipPath(mPath);
canvas.restore();
canvas.drawCircle(mDownX, mDownY, mRadius, mPaint);
}
代码示例来源:origin: fr.avianey/facebook-android-api
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (!nuxChecked && nuxMode != ToolTipMode.NEVER_DISPLAY && !isInEditMode()) {
nuxChecked = true;
checkNuxSettings();
}
}
代码示例来源:origin: derry/delion
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
boolean isRtl = ApiCompatibilityUtils.isLayoutRtl(this);
int paddingStart = ApiCompatibilityUtils.getPaddingStart(this);
int widthWithoutPadding = getWidth() - paddingStart;
canvas.save();
if (!isRtl) canvas.translate(paddingStart, 0);
canvas.save();
canvas.translate(0, (getHeight() - mNormalDrawable.getIntrinsicHeight()) / 2.f);
if (isRtl) {
canvas.translate(widthWithoutPadding - mNormalDrawable.getIntrinsicWidth(), 0);
}
mNormalDrawable.draw(canvas);
canvas.restore();
if (mIsIncognito || (mTransitionAnimation != null && mTransitionAnimation.isRunning())) {
canvas.save();
canvas.translate(0, (getHeight() - mIncognitoDrawable.getIntrinsicHeight()) / 2.f);
if (isRtl) {
canvas.translate(widthWithoutPadding - mIncognitoDrawable.getIntrinsicWidth(), 0);
}
mIncognitoDrawable.draw(canvas);
canvas.restore();
}
canvas.restore();
}
代码示例来源:origin: wusp/IndicatorBox
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if ((animationState == STATE_PROGRESSING || animationState == STATE_SHRINKED) && patternDrawer != null) {
patternDrawer.onDrawPattern(canvas, getWidth(), getHeight(), mProgressFraction);
}
}
代码示例来源:origin: JackWHLiu/jackknife
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (!isInEditMode()) {
drawBackground(canvas);
drawText(canvas);
}
}
代码示例来源:origin: jiang111/CProgressButton
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (mState == STATE.NORMAL || (mState == STATE.PROGRESS && morphingCircle)) {
mBackground.draw(canvas);
} else if (mState == STATE.PROGRESS && !morphingCircle) {
if (mProgressDrawable == null) {
int offset = (mWidth - mHeight) / 2 + getPaddingLeft();
int size = mHeight;
mProgressDrawable = new CProgressDrawable(getContext(), size, mStokeWidth, mStokeWidthOut, mStrokeColor);
int left = offset;
mProgressDrawable.setBounds(left, getPaddingTop(), left + mHeight, getPaddingTop() + mHeight);
}
float sweepAngle = (360f / mMaxProgress) * mProgress;
mProgressDrawable.setSweepAngle(sweepAngle);
mProgressDrawable.draw(canvas);
}
}
内容来源于网络,如有侵权,请联系作者删除!