本文整理匯總了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);
}
}