android.graphics.Paint#setUnderlineText ( )源码实例Demo

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

源代码1 项目: tindroid   文件: BorderedSpan.java
@Override
public void draw(@NonNull Canvas canvas, CharSequence text,
                 int start, int end, float x, int top, int y, int bottom, @NonNull Paint paint) {
    RectF outline = new RectF(x, top, x + mWidth * mDipSize, top + mButtonHeight * mDipSize);
    outline.inset(SHADOW_SIZE * mDipSize, SHADOW_SIZE * mDipSize);
    // Draw colored background
    canvas.drawRoundRect(outline, RADIUS_CORNER * mDipSize, RADIUS_CORNER * mDipSize, mPaintBackground);

    // Don't underline the text.
    paint.setUnderlineText(false);
    paint.setColor(mTextColor);
    canvas.drawText(text, start, end,
            x + (mWidth - mWidthActual) * mDipSize * 0.5f,
            top + (mButtonHeight * mDipSize - paint.ascent() - paint.descent()) * 0.5f,
            paint);
}
 
源代码2 项目: Android-face-filters   文件: TextGraphic.java
public static Bitmap drawTextBitmap(String string, int color, int alpha, int size, boolean underline, int width , int height) {
    Bitmap result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(result);
    //canvas.drawBitmap();
    Paint paint = new Paint();
    paint.setColor(color);
    paint.setAlpha(alpha);
    paint.setTextSize(size);
    paint.setAntiAlias(true);
    paint.setUnderlineText(underline);
    canvas.drawText(string, 100, 150, paint);
    return result;
}
 
源代码3 项目: J2ME-Loader   文件: Font.java
public Font(Typeface face, int style, float size, boolean underline) {
	if (applyDimensions) {
		size = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, size,
				ContextHolder.getAppContext().getResources().getDisplayMetrics());
	}

	paint = new Paint();

	paint.setTypeface(Typeface.create(face, style));
	paint.setUnderlineText(underline);

	paint.setTextSize(size);                                             // at first, just set the size (no matter what is put here)
	paint.setTextSize(size * size / (paint.descent() - paint.ascent())); // and now we set the size equal to the given one (in pixels)
}
 
源代码4 项目: Markwon   文件: MarkwonTheme.java
public void applyLinkStyle(@NonNull Paint paint) {
    paint.setUnderlineText(true);
    if (linkColor != 0) {
        // by default we will be using text color
        paint.setColor(linkColor);
    } else {
        // @since 1.0.5, if link color is specified during configuration, _try_ to use the
        // default one (if provided paint is an instance of TextPaint)
        if (paint instanceof TextPaint) {
            paint.setColor(((TextPaint) paint).linkColor);
        }
    }
}
 
源代码5 项目: starcor.xul   文件: XulSpannedLabelRender.java
private Paint _getTextPaint(float fontSizeScale) {
	Paint defPaint = _ctx.getTextPaintByName(_fontFace);

	if (!(_fontShadowSize == 0 || (_fontShadowColor & 0xFF000000) == 0)) {
		defPaint = _ctx.getShadowTextPaintByName(_fontFace);
		defPaint.setShadowLayer(_fontShadowSize, _fontShadowX, _fontShadowY, _fontShadowColor);
	}

	defPaint.setColor(_fontColor);
	if (Math.abs(fontSizeScale - 1.0f) > 0.01f) {
		defPaint.setTextSize(_fontSize * fontSizeScale);
	} else {
		defPaint.setTextSize(_fontSize);
	}

	//defPaint.setStrokeWidth(_fontWeight / 2.0f);

	if (_fontWeight > 1.0) {
		defPaint.setFakeBoldText(true);
	} else {
		defPaint.setFakeBoldText(false);
	}
	defPaint.setUnderlineText(_fontUnderline);
	defPaint.setTextSkewX(_fontItalic ? -0.25f : 0);
	defPaint.setTextAlign(Paint.Align.LEFT);
	return defPaint;
}
 
源代码6 项目: starcor.xul   文件: XulBasicTextRenderer.java
protected Paint _getTextPaint(float fontSizeScale) {
	XulRenderContext ctx = _render.getRenderContext();
	Paint defPaint = ctx.getTextPaintByName(_fontFace);

	if (!(_fontShadowSize == 0 || (_fontShadowColor & 0xFF000000) == 0)) {
		defPaint = ctx.getShadowTextPaintByName(_fontFace);
		defPaint.setShadowLayer(_fontShadowSize, _fontShadowX, _fontShadowY, _fontShadowColor);
	}

	defPaint.setColor(_fontColor);
	if (Math.abs(fontSizeScale - 1.0f) > 0.01f) {
		defPaint.setTextSize(_fontSize * fontSizeScale);
	} else {
		defPaint.setTextSize(_fontSize);
	}

	if (_fontWeight > 1.0) {
		if (_fontWeight > 2.5) {
			defPaint.setStrokeWidth(_fontWeight*fontSizeScale/2);
		} else {
			defPaint.setFakeBoldText(true);
		}
	} else {
		defPaint.setFakeBoldText(false);
	}
	defPaint.setTextScaleX(_fontScaleX);
	defPaint.setUnderlineText(_fontUnderline);
	defPaint.setStrikeThruText(_fontStrikeThrough);
	defPaint.setTextSkewX(_fontItalic ? -0.25f : 0);
	defPaint.setTextAlign(Paint.Align.LEFT);
	return defPaint;
}
 
源代码7 项目: AndroidCommons   文件: SpannableBuilder.java
private void apply(Paint paint) {
    if (style.typeface != null) {
        paint.setTypeface(style.typeface);
    }
    if (style.color != Style.NO_COLOR) {
        paint.setColor(style.color);
    }
    if (style.size != Style.NO_SIZE) {
        paint.setTextSize(style.size);
    }
    paint.setUnderlineText(style.underline);
}
 
源代码8 项目: J2ME-Loader   文件: Font.java
public void copyInto(Paint target) {
	target.setTypeface(paint.getTypeface());
	target.setUnderlineText(paint.isUnderlineText());
	target.setTextSize(paint.getTextSize());
}