android.text.TextPaint#setStrokeWidth ( )源码实例Demo

下面列出了android.text.TextPaint#setStrokeWidth ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: BambooPlayer   文件: OutlineTextView.java
private void initPaint() {
	mTextPaint = new TextPaint();
	mTextPaint.setAntiAlias(true);
	mTextPaint.setTextSize(getTextSize());
	mTextPaint.setColor(mColor);
	mTextPaint.setStyle(Paint.Style.FILL);
	mTextPaint.setTypeface(getTypeface());

	mTextPaintOutline = new TextPaint();
	mTextPaintOutline.setAntiAlias(true);
	mTextPaintOutline.setTextSize(getTextSize());
	mTextPaintOutline.setColor(mBorderColor);
	mTextPaintOutline.setStyle(Paint.Style.STROKE);
	mTextPaintOutline.setTypeface(getTypeface());
	mTextPaintOutline.setStrokeWidth(mBorderSize);
}
 
源代码2 项目: NetEasyNews   文件: OutlineTextView.java
private void initPaint() {
  mTextPaint = new TextPaint();
  mTextPaint.setAntiAlias(true);
  mTextPaint.setTextSize(getTextSize());
  mTextPaint.setColor(mColor);
  mTextPaint.setStyle(Paint.Style.FILL);
  mTextPaint.setTypeface(getTypeface());

  mTextPaintOutline = new TextPaint();
  mTextPaintOutline.setAntiAlias(true);
  mTextPaintOutline.setTextSize(getTextSize());
  mTextPaintOutline.setColor(mBorderColor);
  mTextPaintOutline.setStyle(Paint.Style.STROKE);
  mTextPaintOutline.setTypeface(getTypeface());
  mTextPaintOutline.setStrokeWidth(mBorderSize);
}
 
源代码3 项目: Vitamio   文件: OutlineTextView.java
private void initPaint() {
  mTextPaint = new TextPaint();
  mTextPaint.setAntiAlias(true);
  mTextPaint.setTextSize(getTextSize());
  mTextPaint.setColor(mColor);
  mTextPaint.setStyle(Paint.Style.FILL);
  mTextPaint.setTypeface(getTypeface());

  mTextPaintOutline = new TextPaint();
  mTextPaintOutline.setAntiAlias(true);
  mTextPaintOutline.setTextSize(getTextSize());
  mTextPaintOutline.setColor(mBorderColor);
  mTextPaintOutline.setStyle(Paint.Style.STROKE);
  mTextPaintOutline.setTypeface(getTypeface());
  mTextPaintOutline.setStrokeWidth(mBorderSize);
}
 
源代码4 项目: BambooPlayer   文件: OutlineTextView.java
private void initPaint() {
  mTextPaint = new TextPaint();
  mTextPaint.setAntiAlias(true);
  mTextPaint.setTextSize(getTextSize());
  mTextPaint.setColor(mColor);
  mTextPaint.setStyle(Paint.Style.FILL);
  mTextPaint.setTypeface(getTypeface());

  mTextPaintOutline = new TextPaint();
  mTextPaintOutline.setAntiAlias(true);
  mTextPaintOutline.setTextSize(getTextSize());
  mTextPaintOutline.setColor(mBorderColor);
  mTextPaintOutline.setStyle(Paint.Style.STROKE);
  mTextPaintOutline.setTypeface(getTypeface());
  mTextPaintOutline.setStrokeWidth(mBorderSize);
}
 
源代码5 项目: android-slidr   文件: Sushi.java
public Settings(Sushi slidr) {
    this.slidr = slidr;

    paintBar = new Paint();
    paintBar.setAntiAlias(true);
    paintBar.setStrokeWidth(2);
    paintBar.setColor(colorBackground);

    paintTextTop = new TextPaint();
    paintTextTop.setAntiAlias(true);
    paintTextTop.setStyle(Paint.Style.FILL);
    paintTextTop.setColor(textColor);
    paintTextTop.setTextSize(dpToPx(textSize));

    paintTextBubble = new TextPaint();
    paintTextBubble.setAntiAlias(true);
    paintTextBubble.setStyle(Paint.Style.FILL);
    paintTextBubble.setColor(Color.WHITE);
    paintTextBubble.setStrokeWidth(2);
    paintTextBubble.setTextSize(dpToPx(textSizeBubble));

    paintBubble = new Paint();
    paintBubble.setAntiAlias(true);
    paintBubble.setStrokeWidth(3);
}
 
private void initPaint() {
  mTextPaint = new TextPaint();
  mTextPaint.setAntiAlias(true);
  mTextPaint.setTextSize(getTextSize());
  mTextPaint.setColor(mColor);
  mTextPaint.setStyle(Paint.Style.FILL);
  mTextPaint.setTypeface(getTypeface());

  mTextPaintOutline = new TextPaint();
  mTextPaintOutline.setAntiAlias(true);
  mTextPaintOutline.setTextSize(getTextSize());
  mTextPaintOutline.setColor(mBorderColor);
  mTextPaintOutline.setStyle(Paint.Style.STROKE);
  mTextPaintOutline.setTypeface(getTypeface());
  mTextPaintOutline.setStrokeWidth(mBorderSize);
}
 
源代码7 项目: MyHearts   文件: OutlineTextView.java
private void initPaint() {
  mTextPaint = new TextPaint();
  mTextPaint.setAntiAlias(true);
  mTextPaint.setTextSize(getTextSize());
  mTextPaint.setColor(mColor);
  mTextPaint.setStyle(Paint.Style.FILL);
  mTextPaint.setTypeface(getTypeface());

  mTextPaintOutline = new TextPaint();
  mTextPaintOutline.setAntiAlias(true);
  mTextPaintOutline.setTextSize(getTextSize());
  mTextPaintOutline.setColor(mBorderColor);
  mTextPaintOutline.setStyle(Paint.Style.STROKE);
  mTextPaintOutline.setTypeface(getTypeface());
  mTextPaintOutline.setStrokeWidth(mBorderSize);
}
 
源代码8 项目: HPlayer   文件: OutlineTextView.java
private void initPaint() {
  mTextPaint = new TextPaint();
  mTextPaint.setAntiAlias(true);
  mTextPaint.setTextSize(getTextSize());
  mTextPaint.setColor(mColor);
  mTextPaint.setStyle(Paint.Style.FILL);
  mTextPaint.setTypeface(getTypeface());

  mTextPaintOutline = new TextPaint();
  mTextPaintOutline.setAntiAlias(true);
  mTextPaintOutline.setTextSize(getTextSize());
  mTextPaintOutline.setColor(mBorderColor);
  mTextPaintOutline.setStyle(Paint.Style.STROKE);
  mTextPaintOutline.setTypeface(getTypeface());
  mTextPaintOutline.setStrokeWidth(mBorderSize);
}
 
源代码9 项目: video-player   文件: OutlineTextView.java
private void initPaint() {
  mTextPaint = new TextPaint();
  mTextPaint.setAntiAlias(true);
  mTextPaint.setTextSize(getTextSize());
  mTextPaint.setColor(mColor);
  mTextPaint.setStyle(Paint.Style.FILL);
  mTextPaint.setTypeface(getTypeface());

  mTextPaintOutline = new TextPaint();
  mTextPaintOutline.setAntiAlias(true);
  mTextPaintOutline.setTextSize(getTextSize());
  mTextPaintOutline.setColor(mBorderColor);
  mTextPaintOutline.setStyle(Paint.Style.STROKE);
  mTextPaintOutline.setTypeface(getTypeface());
  mTextPaintOutline.setStrokeWidth(mBorderSize);
}
 
源代码10 项目: mobile-manager-tool   文件: OutlineTextView.java
private void initPaint() {
	mTextPaint = new TextPaint();
	mTextPaint.setAntiAlias(true);
	mTextPaint.setTextSize(getTextSize());
	mTextPaint.setColor(mColor);
	mTextPaint.setStyle(Paint.Style.FILL);
	mTextPaint.setTypeface(getTypeface());

	mTextPaintOutline = new TextPaint();
	mTextPaintOutline.setAntiAlias(true);
	mTextPaintOutline.setTextSize(getTextSize());
	mTextPaintOutline.setColor(mBorderColor);
	mTextPaintOutline.setStyle(Paint.Style.STROKE);
	mTextPaintOutline.setTypeface(getTypeface());
	mTextPaintOutline.setStrokeWidth(mBorderSize);
}
 
源代码11 项目: FimiX8-RE   文件: MediaStrokeTextView.java
public void init() {
    TextPaint tp1 = this.borderText.getPaint();
    tp1.setStrokeWidth(1.0f);
    tp1.setStyle(Style.STROKE);
    this.borderText.setTextColor(1275068416);
    this.borderText.setGravity(getGravity());
}
 
源代码12 项目: FimiX8-RE   文件: X8MiLantingStrokeTextView.java
public void init(Context mContext) {
    TextPaint tp1 = this.borderText.getPaint();
    tp1.setStrokeWidth(1.0f);
    tp1.setStyle(Style.STROKE);
    this.borderText.setTextColor(855638016);
    this.borderText.setGravity(getGravity());
    FontUtil.changeFontLanTing(mContext.getAssets(), this.borderText, this);
}
 
源代码13 项目: VideoOS-Android-SDK   文件: WeightStyleSpan.java
@Override
public void updateDrawState(TextPaint paint) {
    final float newStrokeWidth = (mWeight / (UDFontWeight.WEIGHT_NORMAL_INT + 0.0f));
    if (paint.getStyle() == Paint.Style.FILL) {
        paint.setStyle(Paint.Style.FILL_AND_STROKE);
    }
    paint.setStrokeWidth(newStrokeWidth);
}
 
源代码14 项目: PhotoMovie   文件: SubtitleLayer.java
private Bitmap genBitmapFromStr(String str, TextPaint textPaint, float density) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }

        Paint.FontMetrics fontMetrics = textPaint.getFontMetrics();
        int h = (int) (Math.abs(fontMetrics.ascent) + Math.abs(fontMetrics.descent));
        int w = (int) textPaint.measureText(str);
        Bitmap bitmap = PhotoUtil.createBitmapOrNull(w, h, Bitmap.Config.ARGB_4444);
        if (bitmap == null) {
            return null;
        }
        Canvas canvas = new Canvas(bitmap);
        // 描外层
        textPaint.setColor(0xFF343434);
        textPaint.setStrokeWidth(density * STROKE_WIDTH_DP + 0.5f);  // 描边宽度
        textPaint.setStyle(Paint.Style.FILL_AND_STROKE); //描边种类
        textPaint.setFakeBoldText(true); // 外层text采用粗体
//        textPaint.setShadowLayer(1, 0, 0, 0); //字体的阴影效果,可以忽略
        canvas.drawText(str, 0, Math.abs(fontMetrics.ascent), textPaint);

        // 描内层,恢复原先的画笔
        textPaint.setColor(0xFFFFFFFF);
        textPaint.setStrokeWidth(0);
        textPaint.setStyle(Paint.Style.FILL_AND_STROKE);
        textPaint.setFakeBoldText(false);
//        textPaint.setShadowLayer(0, 0, 0, 0);
        canvas.drawText(str, 0, Math.abs(fontMetrics.ascent), textPaint);

        return bitmap;
    }
 
public PrimitiveDrawer(Context context, AttributeSet attributeSet) {
    super(context, attributeSet);

    paint = new TextPaint();
    paint.setStyle(Paint.Style.FILL);
    paint.setAntiAlias(true);
    paint.setColor(0xffffffff);
    paint.setStrokeWidth(1.f);
    paint.setTextSize(35.f);
    paint.setTextAlign(Paint.Align.LEFT);
}
 
源代码16 项目: FastTextView   文件: StrokeSpan.java
@Override
public void updateDrawState(TextPaint tp) {
  if (mDrawStroke) {
    tp.setColor(mStrokeColor);
    tp.setStrokeCap(Paint.Cap.ROUND);
    tp.setStrokeWidth(mStrokeWidth);
    tp.setStyle(Paint.Style.STROKE);
  } else {
    tp.setColor(mTextColor);
    tp.setStyle(Paint.Style.FILL);
  }
}
 
源代码17 项目: android-slidr   文件: Slidr.java
public Settings(Slidr slidr) {
    this.slidr = slidr;

    paintIndicator = new Paint();
    paintIndicator.setAntiAlias(true);
    paintIndicator.setStrokeWidth(2);

    paintBar = new Paint();
    paintBar.setAntiAlias(true);
    paintBar.setStrokeWidth(2);
    paintBar.setColor(colorBackground);

    paintStep = new Paint();
    paintStep.setAntiAlias(true);
    paintStep.setStrokeWidth(5);
    paintStep.setColor(colorStoppover);

    paintTextTop = new TextPaint();
    paintTextTop.setAntiAlias(true);
    paintTextTop.setStyle(Paint.Style.FILL);
    paintTextTop.setColor(textColor);
    paintTextTop.setTextSize(textTopSize);

    paintTextBottom = new TextPaint();
    paintTextBottom.setAntiAlias(true);
    paintTextBottom.setStyle(Paint.Style.FILL);
    paintTextBottom.setColor(textColor);
    paintTextBottom.setTextSize(textBottomSize);

    paintBubbleTextCurrent = new TextPaint();
    paintBubbleTextCurrent.setAntiAlias(true);
    paintBubbleTextCurrent.setStyle(Paint.Style.FILL);
    paintBubbleTextCurrent.setColor(Color.WHITE);
    paintBubbleTextCurrent.setStrokeWidth(2);
    paintBubbleTextCurrent.setTextSize(dpToPx(textSizeBubbleCurrent));

    paintBubble = new Paint();
    paintBubble.setAntiAlias(true);
    paintBubble.setStrokeWidth(3);
}
 
源代码18 项目: GSYRickText   文件: CustomClickTopicSpan.java
@Override
public void updateDrawState(TextPaint ds) {
    super.updateDrawState(ds);
    ds.setUnderlineText(true);
    ds.setStyle(Paint.Style.FILL_AND_STROKE);
    PathEffect effects = new DashPathEffect(new float[]{1, 1}, 1);
    ds.setPathEffect(effects);
    ds.setStrokeWidth(2);
}
 
源代码19 项目: CloudReader   文件: ThinBoldSpan.java
@Override
public void updateDrawState(TextPaint tp) {
    tp.setStyle(Paint.Style.FILL_AND_STROKE);
    //控制字体加粗的程度
    tp.setStrokeWidth(dpToPx(context, f));
}
 
源代码20 项目: remixed-dungeon   文件: SystemText.java
public SystemText(final String text, float size, boolean multiline) {
	super(0, 0, 0, 0);

	if (fontScale != fontScale) {
		updateFontScale();
	}

	if (tf == null) {
		if (Game.smallResScreen()) {
			tf = Typeface.create((String) null, Typeface.BOLD);
			oversample = 1;
		} else {
			tf = Typeface.create((String) null, Typeface.NORMAL);
			oversample = 4;
		}
	}

	size *= fontScale;

	needWidth = multiline;

	if (size == 0) {
		throw new TrackedRuntimeException("zero sized font!!!");
	}

	float textSize = size * oversample;
	if (!textPaints.containsKey(textSize)) {
		TextPaint tx = new TextPaint();

		tx.setTextSize(textSize);
		tx.setStyle(Paint.Style.FILL_AND_STROKE);
		tx.setHinting(Paint.HINTING_ON);
		tx.setAntiAlias(true);

		tx.setColor(Color.WHITE);

		tx.setTypeface(tf);

		TextPaint cp = new TextPaint();
		cp.set(tx);
		cp.setStyle(Paint.Style.FILL_AND_STROKE);
		cp.setStrokeWidth(textSize * 0.2f);
		cp.setColor(Color.BLACK);
		cp.setAntiAlias(true);

		textPaints.put(textSize, tx);
		contourPaints.put(textSize, cp);
	}

	textPaint = textPaints.get(textSize);
	contourPaint = contourPaints.get(textSize);

	this.text(text);
	texts.add(this);
}