本文整理汇总了Java中android.text.TextPaint.setStrokeWidth方法的典型用法代码示例。如果您正苦于以下问题:Java TextPaint.setStrokeWidth方法的具体用法?Java TextPaint.setStrokeWidth怎么用?Java TextPaint.setStrokeWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.text.TextPaint
的用法示例。
在下文中一共展示了TextPaint.setStrokeWidth方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: initPaint
import android.text.TextPaint; //导入方法依赖的package包/类
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: initPaint
import android.text.TextPaint; //导入方法依赖的package包/类
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: Settings
import android.text.TextPaint; //导入方法依赖的package包/类
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);
}
示例5: updateDrawState
import android.text.TextPaint; //导入方法依赖的package包/类
@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);
}
示例6: PrimitiveDrawer
import android.text.TextPaint; //导入方法依赖的package包/类
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);
}
示例7: 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);
}
}
示例8: updateDrawState
import android.text.TextPaint; //导入方法依赖的package包/类
@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);
}
}
示例9: Settings
import android.text.TextPaint; //导入方法依赖的package包/类
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);
}
示例10: AndroidDisplayer
import android.text.TextPaint; //导入方法依赖的package包/类
public AndroidDisplayer() {
PAINT = new TextPaint();
PAINT.setStrokeWidth(STROKE_WIDTH);
PAINT_DUPLICATE = new TextPaint(PAINT);
ALPHA_PAINT = new Paint();
UNDERLINE_PAINT = new Paint();
UNDERLINE_PAINT.setStrokeWidth(UNDERLINE_HEIGHT);
UNDERLINE_PAINT.setStyle(Style.STROKE);
BORDER_PAINT = new Paint();
BORDER_PAINT.setStyle(Style.STROKE);
BORDER_PAINT.setStrokeWidth(BORDER_WIDTH);
}
示例11: CandidateView
import android.text.TextPaint; //导入方法依赖的package包/类
/**
* Construct a CandidateView for showing suggested words for completion.
* @param context context
*/
public CandidateView(Context context) {
super(context);
mService = (QuranKeyboardIME) context;
mSelectionHighlight = ContextCompat.getDrawable(context,
android.R.drawable.list_selector_background);
mSelectionHighlight.setState(new int[] {
android.R.attr.state_enabled,
android.R.attr.state_focused,
android.R.attr.state_window_focused,
android.R.attr.state_pressed
});
Resources r = context.getResources();
setBackgroundColor(ContextCompat.getColor(context, R.color.candidate_background));
mColorNormal = ContextCompat.getColor(context, R.color.candidate_normal);
mColorRecommended = ContextCompat.getColor(context, R.color.candidate_recommended);
mColorOther = ContextCompat.getColor(context, R.color.candidate_other);
mVerticalPadding = r.getDimensionPixelSize(R.dimen.candidate_vertical_padding);
mPaint = new TextPaint();
mPaint.setColor(mColorNormal);
mPaint.setAntiAlias(true);
mPaint.setTextSize(r.getDimensionPixelSize(R.dimen.candidate_font_height));
mPaint.setStrokeWidth(0);
mDefaultTf = mPaint.getTypeface();
mUthamniTf = mService.getUthmaniTypeFace();
mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2,
float distanceX, float distanceY) {
mScrolled = true;
int sx = getScrollX();
sx += distanceX;
if (sx < 0) {
sx = 0;
}
if (sx + getWidth() > mTotalWidth) {
sx -= distanceX;
}
mTargetScrollX = sx;
scrollTo(sx, getScrollY());
invalidate();
return true;
}
});
setHorizontalFadingEdgeEnabled(true);
setWillNotDraw(false);
setHorizontalScrollBarEnabled(false);
setVerticalScrollBarEnabled(false);
}