本文整理汇总了Java中android.text.TextPaint.setStrokeMiter方法的典型用法代码示例。如果您正苦于以下问题:Java TextPaint.setStrokeMiter方法的具体用法?Java TextPaint.setStrokeMiter怎么用?Java TextPaint.setStrokeMiter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.text.TextPaint
的用法示例。
在下文中一共展示了TextPaint.setStrokeMiter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDraw
import android.text.TextPaint; //导入方法依赖的package包/类
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
int restoreColor = this.getCurrentTextColor();
if (strokeColor != null) {
TextPaint paint = this.getPaint();
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeJoin(strokeJoin);
paint.setStrokeMiter(strokeMiter);
this.setTextColor(strokeColor);
paint.setStrokeWidth(strokeWidth);
super.onDraw(canvas);
paint.setStyle(Paint.Style.FILL);
this.setTextColor(restoreColor);
}
}
示例2: onDraw
import android.text.TextPaint; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
Canvas c = canvas;
if (mExternalSurface != null) {
try {
canvas.getClipBounds(r);
getLocationOnScreen(location);
r.offsetTo(location[0],location[1]);
c = mExternalSurface.lockCanvas(null);
c.save();
c.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
c.clipRect(r);
c.translate(location[0],location[1]);
} catch (Exception ignored) {
}
}
TextPaint paint = getPaint();
int color = getCurrentTextColor();
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeJoin(Paint.Join.MITER);
paint.setStrokeMiter(1.0f);
paint.setStrokeWidth(4.0f);
setTextColor(Color.BLACK);
super.onDraw(c);
paint.setStyle(Paint.Style.FILL);
setTextColor(color);
super.onDraw(c);
if (c != canvas) {
c.restore();
mExternalSurface.unlockCanvasAndPost(c);
}
}