android.widget.TextView.onDraw()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(172)

本文整理了Java中android.widget.TextView.onDraw()方法的一些代码示例,展示了TextView.onDraw()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.onDraw()方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:onDraw

TextView.onDraw介绍

暂无

代码示例

代码示例来源:origin: xinghongfei/LookLook

@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
}

代码示例来源:origin: zjw-swun/AppMethodOrder

@Override
protected void onDraw(Canvas canvas) {
  super.onDraw(canvas);
}

代码示例来源:origin: Bearded-Hen/Android-Bootstrap

@Override protected void onDraw(Canvas canvas) {
    canvas.drawLine(0, 1, canvas.getWidth(), 1, paint);
    super.onDraw(canvas);
  }
}

代码示例来源:origin: qiujuer/Genius-Android

@Override
  protected void onDraw(Canvas canvas) {
    Drawable drawable = mBorderDrawable;
    if (drawable != null && mBorderSize > 0 && mBorderColor != 0)
      drawable.draw(canvas);
    super.onDraw(canvas);
  }
}

代码示例来源:origin: smuyyh/BookReader

@Override
protected void onDraw(Canvas canvas) {
  //canvas.drawArc(mLeftCornerRectF, -180, 90, true, mBackgroundPaint);
  //canvas.drawArc(mLeftCornerRectF, -270, 90, true, mBackgroundPaint);
  //canvas.drawArc(mRightCornerRectF, -90, 90, true, mBackgroundPaint);
  //canvas.drawArc(mRightCornerRectF, 0, 90, true, mBackgroundPaint);
  canvas.drawRect(mHorizontalBlankFillRectF, mBackgroundPaint);
  canvas.drawRect(mVerticalBlankFillRectF, mBackgroundPaint);
  if (isChecked) {
    canvas.save();
    canvas.rotate(45, mCheckedMarkerBound.centerX(), mCheckedMarkerBound.centerY());
    canvas.drawLine(mCheckedMarkerBound.left, mCheckedMarkerBound.centerY(),
        mCheckedMarkerBound.right, mCheckedMarkerBound.centerY(), mCheckedMarkerPaint);
    canvas.drawLine(mCheckedMarkerBound.centerX(), mCheckedMarkerBound.top,
        mCheckedMarkerBound.centerX(), mCheckedMarkerBound.bottom, mCheckedMarkerPaint);
    canvas.restore();
  }
  canvas.drawPath(mBorderPath, mBorderPaint);
  super.onDraw(canvas);
}

代码示例来源:origin: Yalantis/uCrop

@Override
protected void onDraw(Canvas canvas) {
  super.onDraw(canvas);
  if (isSelected()) {
    canvas.getClipBounds(mCanvasClipBounds);
    canvas.drawCircle((mCanvasClipBounds.right - mCanvasClipBounds.left) / 2.0f, mCanvasClipBounds.bottom - mDotSize,
        mDotSize / 2, mDotPaint);
  }
}

代码示例来源:origin: iSoron/uhabits

@Override
public void onDraw(Canvas canvas) {
  super.onDraw(canvas);
  if (mDrawCircle) {
    final int width = getWidth();
    final int height = getHeight();
    int radius = Math.min(width, height) / 2;
    canvas.drawCircle(width / 2, height / 2, radius, mCirclePaint);
  }
}

代码示例来源:origin: wangdan/AisenWeiBo

public void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    if (mDrawCircle) {
      int width = getWidth();
      int heigth = getHeight();
      int radius = Math.min(width, heigth) / 2;
      canvas.drawCircle(width / 2, heigth / 2, radius, mCirclePaint);
    }
  }
}

代码示例来源:origin: aa112901/remusic

@Override
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    if(matrix !=null){
      deltaX += mWidth / 5;
      if(deltaX > 2 * mWidth){
        deltaX = -mWidth;
      }
    }
    //关键代码通过矩阵的平移实现
    matrix.setTranslate(deltaX, 0);
    gradient.setLocalMatrix(matrix);
    postInvalidateDelayed(100);
  }
}

代码示例来源:origin: smuyyh/BookReader

@Override
  protected void onDraw(Canvas canvas) {
    Drawable[] drawables = getCompoundDrawables();
    if (drawables != null) {
      Drawable drawableLeft = drawables[0];
      if (drawableLeft != null) {
        float textWidth = getPaint().measureText(getText().toString());
        int drawablePadding = getCompoundDrawablePadding();
        int drawableWidth = 0;
        drawableWidth = drawableLeft.getIntrinsicWidth();
        float bodyWidth = textWidth + drawableWidth + drawablePadding;
        canvas.translate((getWidth() - bodyWidth) / 11 * 5, 0);
      }
    }
    super.onDraw(canvas);
  }
}

代码示例来源:origin: gzu-liyujiang/AndroidPicker

@Override
protected void onDraw(Canvas canvas) {
  if (!isStroke) {
    super.onDraw(canvas);
    return;
  }
  if (textColor == borderColor) {
    borderColor = ConvertUtils.toDarkenColor(borderColor, 0.7f);
  }
  // 描外层
  setTextColorUseReflection(borderColor);
  textPaint.setStrokeWidth(ConvertUtils.toPx(getContext(), borderWidth));
  textPaint.setStyle(Paint.Style.STROKE);
  textPaint.setFakeBoldText(true); // 外层文字采用粗体
  super.onDraw(canvas);
  // 描内层
  setTextColorUseReflection(textColor);
  textPaint.setStrokeWidth(0);
  textPaint.setStyle(Paint.Style.FILL);
  textPaint.setFakeBoldText(false); // 内层文字不采用粗体
  super.onDraw(canvas);
}

代码示例来源:origin: lygttpod/AndroidCustomView

@Override
  protected void onDraw(final Canvas canvas) {
    super.onDraw(canvas);
//        使用setText代替重绘就不用自己去绘制text了
//        if (stringBuffer != null) {
//            drawText(canvas, stringBuffer.toString());
//        }
  }

代码示例来源:origin: marzika/Snapprefs

@Override
  protected void onDraw(@NonNull Canvas canvas) {
    for (int i = 0; i < 5; i++)
      super.onDraw(canvas);
  }
}

代码示例来源:origin: haibuzou/ExpandTable

@Override
protected void onDraw(Canvas canvas) {
  canvas.drawLine(0, mheight - 1, mwidth - 1, mheight - 1, paint);
  canvas.drawLine(mwidth - 1, mheight - 1, mwidth - 1, 0, paint);
  super.onDraw(canvas);
}

代码示例来源:origin: lguipeng/BubbleView

@Override
protected void onDraw(Canvas canvas) {
  if (bubbleDrawable != null)
    bubbleDrawable.draw(canvas);
  super.onDraw(canvas);
}

代码示例来源:origin: maimingliang/WxRecoderVideo

@Override
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    mRectF.set(
        DEFAULT_STROKE_WIDTH / 2f,
        DEFAULT_STROKE_WIDTH / 2f,
        canvas.getWidth() - DEFAULT_STROKE_WIDTH / 2f,
        canvas.getHeight() - DEFAULT_STROKE_WIDTH / 2f);

    canvas.drawOval(mRectF, mPaint);
  }
}

代码示例来源:origin: hsllany/HtmlNative

@Override
protected void onDraw(Canvas canvas) {
  mBackgroundMgr.onDraw(canvas);
  super.onDraw(canvas);
}

代码示例来源:origin: SwiftyWang/FingerColoring-Android

@Override
protected void onDraw(Canvas canvas) {
  super.onDraw(canvas);
  if (mCurrentLayout[0] != 0 || mCurrentLayout[1] != 0 || mCurrentLayout[2] != 0 || mCurrentLayout[3] != 0)
    layout(mCurrentLayout[0], mCurrentLayout[1], mCurrentLayout[2], mCurrentLayout[3]);
}

代码示例来源:origin: evilbinary/TvWidget

@Override
protected void onDraw(Canvas canvas) {
  if (mKeyNumber >= 0) {
    super.getDrawingRect(mRect);
    drawBottomNumberText(canvas, "" + mKeyNumber, mPaint);
  }
  super.onDraw(canvas);
}

代码示例来源:origin: intrications/intent-intercept

@Override
protected void onDraw(@NonNull Canvas canvas) {
  super.onDraw(canvas);
  canvas.drawRect(0, getHeight() - mUnderlineHeight, getWidth(),
      getHeight(), mPaint);
}

相关文章

TextView类方法