本文整理汇总了Java中android.graphics.Paint.setStrokeWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Paint.setStrokeWidth方法的具体用法?Java Paint.setStrokeWidth怎么用?Java Paint.setStrokeWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.Paint
的用法示例。
在下文中一共展示了Paint.setStrokeWidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawBorder
import android.graphics.Paint; //导入方法依赖的package包/类
private void drawBorder(Canvas canvas){
if(mBorderWidth > 0){
Paint paint = new Paint();
paint.setStrokeWidth(mBorderWidth);
paint.setStyle(Paint.Style.STROKE);
paint.setColor(mBorderColor);
paint.setAntiAlias(true);
if (mShapeType == 0) {
canvas.drawCircle(mWidth / 2, mHeight / 2, mWidth / 2, paint);
} else {
// 当ShapeType = 1 时 图片为圆角矩形
RectF rectf = new RectF(0, 0, getWidth(), getHeight());
canvas.drawRoundRect(rectf, mRadius, mRadius, paint);
}
}
}
示例2: drawBackground
import android.graphics.Paint; //导入方法依赖的package包/类
private void drawBackground() {
canvasBack.drawColor(ContextCompat.getColor(getContext(), android.R.color.background_light));
Paint p1 = new Paint();
p1.setStrokeWidth(3);
p1.setColor(ContextCompat.getColor(getContext(), R.color.colorBadMood));
canvasBack.drawLine(0, baseLineY, width, baseLineY, p1);
Paint p2 = new Paint();
p2.setStrokeWidth(3);
p2.setColor(ContextCompat.getColor(getContext(), R.color.colorDissatisfied));
canvasBack.drawLine(0, baseLineY - abstandY, width, baseLineY - abstandY, p2);
Paint p3 = new Paint();
p3.setStrokeWidth(3);
p3.setColor(ContextCompat.getColor(getContext(), R.color.colorNeutral));
canvasBack.drawLine(0, baseLineY - (2 * abstandY), width, baseLineY - (2 * abstandY), p3);
Paint p4 = new Paint();
p4.setStrokeWidth(3);
p4.setColor(ContextCompat.getColor(getContext(), R.color.colorSatisfied));
canvasBack.drawLine(0, baseLineY - (3 * abstandY), width, baseLineY - (3 * abstandY), p4);
Paint p5 = new Paint();
p5.setStrokeWidth(3);
p5.setColor(ContextCompat.getColor(getContext(), R.color.colorVerySatisfied));
canvasBack.drawLine(0, baseLineY - (4 * abstandY), width, baseLineY - (4 * abstandY), p5);
}
示例3: init
import android.graphics.Paint; //导入方法依赖的package包/类
private void init() {
mLinePath = new Path();
mLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
mLinePaint.setColor(0xFFF90382);
mLinePaint.setStyle(Paint.Style.STROKE);
mLinePaint.setStrokeWidth(10.0f);
mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
mTextPaint.setColor(Color.WHITE);
mTextPaint.setTextSize(Util.sp2px(mContext, 13.0f));
mBubblePaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
mBubblePaint.setColor(0xFF3B4DEC);
mBubblePath = new Path();
mBubbleRect = new RectF();
}
示例4: drawCenterRect
import android.graphics.Paint; //导入方法依赖的package包/类
/**
* Draws rect for current value
* @param canvas the canvas for drawing
*/
private void drawCenterRect(Canvas canvas) {
int center = getHeight() / 2;
int offset = (int) (getItemHeight() / 2 * 1.2);
/*/ Remarked by wulianghuan 2014-11-27 使用自己的画线,而不是描边
Rect rect = new Rect(left, top, right, bottom)
centerDrawable.setBounds(bounds)
centerDrawable.setBounds(0, center - offset, getWidth(), center + offset);
centerDrawable.draw(canvas);
//*/
Paint paint = new Paint();
paint.setColor(getResources().getColor(R.color.red_500));
// 设置线宽
paint.setStrokeWidth((float) 3);
// 绘制上边直线
canvas.drawLine(0, center - offset, getWidth(), center - offset, paint);
// 绘制下边直线
canvas.drawLine(0, center + offset, getWidth(), center + offset, paint);
//*/
}
示例5: UnderLinePageIndicator
import android.graphics.Paint; //导入方法依赖的package包/类
public UnderLinePageIndicator(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
setHorizontalScrollBarEnabled(false);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TabPageIndicator, defStyle, 0);
selectedTextColor = a.getColor(R.styleable.TabPageIndicator_selectedTextColor,
Color.parseColor("#F28300"));
unSelectedTextColor = a.getColor(R.styleable.TabPageIndicator_unSelectedTextColor,
Color.BLACK);
tabWidth = (int) a.getDimension(R.styleable.TabPageIndicator_tagWidth, 0);
mTabLayout = new IcsLinearLayout(context, R.attr.vpiTabPageIndicatorStyle);
addView(mTabLayout, new ViewGroup.LayoutParams(WRAP_CONTENT, MATCH_PARENT));
//用来绘制滚动的下划线
mPaint = new Paint();
mPaint.setColor(selectedTextColor);
mPaint.setStrokeWidth(lineHeight);
setWillNotDraw(false);
}
示例6: initPaints
import android.graphics.Paint; //导入方法依赖的package包/类
/**
* initialize paints
*/
private void initPaints(){
defaultPaint = new Paint();
defaultPaint.setColor(getResources().getColor(R.color.blue_78d2f6));
defaultPaint.setStrokeWidth(2.0f);
defaultPaint.setStyle(Style.STROKE);
defaultPaint.setAntiAlias(true);
selectPaint = new Paint();
selectPaint.setColor(getResources().getColor(R.color.blue_00aaee));
selectPaint.setStrokeWidth(3.0f);
//selectPaint.setStyle(Style.STROKE);
selectPaint.setAntiAlias(true);
errorPaint = new Paint();
errorPaint.setColor(getResources().getColor(R.color.red_f3323b));
errorPaint.setStrokeWidth(3.0f);
//errorPaint.setStyle(Style.STROKE);
errorPaint.setAntiAlias(true);
}
示例7: render
import android.graphics.Paint; //导入方法依赖的package包/类
public void render(Canvas canvas) {
if (this.canvas == null) return;
float scaleX = 1.0F * canvas.getWidth() / this.canvas.getWidth();
float scaleY = 1.0F * canvas.getHeight() / this.canvas.getHeight();
Matrix matrix = new Matrix();
matrix.setScale(scaleX, scaleY);
for (int i = 0; i < this.historyPointer; i++) {
Path path = this.pathLists.get(i);
Paint paint = this.paintLists.get(i);
Path scaledPath = new Path();
path.transform(matrix, scaledPath);
Paint scaledPaint = new Paint(paint);
scaledPaint.setStrokeWidth(scaledPaint.getStrokeWidth() * scaleX);
canvas.drawPath(scaledPath, scaledPaint);
}
}
示例8: setViewPaint
import android.graphics.Paint; //导入方法依赖的package包/类
public void setViewPaint() {
//绘制风格
paint = new Paint();
//去锯齿
paint.setAntiAlias(true);
//设置绘制颜色
paint.setColor(getResources().getColor(android.R.color.holo_blue_light));
//为了方便看Path的路径效果
//设置绘制风格为空心
paint.setStyle(Paint.Style.STROKE);
//设置空心边框的宽度
paint.setStrokeWidth(10);
}
示例9: initPaint
import android.graphics.Paint; //导入方法依赖的package包/类
private void initPaint() {
mBgPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mBgPaint.setColor(bgColor);
mShortLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mShortLinePaint.setColor(Color.WHITE);
mShortLinePaint.setStrokeWidth(mShortLineWidth);
mHighLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mHighLinePaint.setColor(Color.WHITE);
mHighLinePaint.setStrokeWidth(mHighLineWidth);
mIndicatorTxtPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mIndicatorTxtPaint.setColor(keduColor);
mIndicatorTxtPaint.setTextSize(mScaleTextsize);
mIndicatorViewPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mIndicatorViewPaint.setColor(Color.WHITE);
mValuePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mValuePaint.setColor(valueColor);
mValuePaint.setStrokeWidth(mHighLineWidth);
mValuePaint.setTextSize(mValueTextsize);
mDanweiPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mDanweiPaint.setColor(Color.DKGRAY);
mDanweiPaint.setStrokeWidth(mHighLineWidth);
mDanweiPaint.setTextSize(18);
}
示例10: MapPlaceholderDrawable
import android.graphics.Paint; //导入方法依赖的package包/类
public MapPlaceholderDrawable() {
super();
paint = new Paint();
paint.setColor(0xffded7d6);
linePaint = new Paint();
linePaint.setColor(0xffc6bfbe);
linePaint.setStrokeWidth(AndroidUtilities.dp(1));
}
示例11: init
import android.graphics.Paint; //导入方法依赖的package包/类
private void init() {
setBackgroundColor(Color.TRANSPARENT);
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setColor(Color.WHITE);
paddingSize = PixelUtil.dp2px(3);
mPaint.setStrokeWidth(paddingSize);
bgPaint = new Paint();
bgPaint.setAntiAlias(true);
bgPaint.setStyle(Paint.Style.FILL);
bgPaint.setColor(Color.WHITE);
}
示例12: detect
import android.graphics.Paint; //导入方法依赖的package包/类
private void detect(JSONObject obj) throws JSONException {
int ret = obj.getInt("ret");
if (ret != 0) {
showTip("���ʧ��");
return;
}
if ("success".equals(obj.get("rst"))) {
JSONArray faceArray = obj.getJSONArray("face");
Paint paint = new Paint();
paint.setColor(Color.RED);
paint.setStrokeWidth(Math.max(mImage.getWidth(), mImage.getHeight()) / 100f);
Bitmap bitmap = Bitmap.createBitmap(mImage.getWidth(),
mImage.getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
canvas.drawBitmap(mImage, new Matrix(), null);
for (int i = 0; i < faceArray.length(); i++) {
float x1 = (float) faceArray.getJSONObject(i)
.getJSONObject("position").getDouble("left");
float y1 = (float) faceArray.getJSONObject(i)
.getJSONObject("position").getDouble("top");
float x2 = (float) faceArray.getJSONObject(i)
.getJSONObject("position").getDouble("right");
float y2 = (float) faceArray.getJSONObject(i)
.getJSONObject("position").getDouble("bottom");
paint.setStyle(Style.STROKE);
canvas.drawRect(new Rect((int)x1, (int)y1, (int)x2, (int)y2),
paint);
}
mImage = bitmap;
((ImageView) findViewById(R.id.online_img)).setImageBitmap(mImage);
} else {
showTip("���ʧ��");
}
}
示例13: init
import android.graphics.Paint; //导入方法依赖的package包/类
private void init(LineConfig config) {
bgPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
bgPaint.setColor(Color.TRANSPARENT);
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setStrokeWidth(config.getThick());
paint.setColor(config.getColor());
paint.setAlpha(config.getAlpha());
}
示例14: setupView
import android.graphics.Paint; //导入方法依赖的package包/类
private void setupView() {
linePaint = new Paint();
linePaint.setAntiAlias(true);//抗锯齿
linePaint.setStyle(Paint.Style.STROKE);//STROKE描边FILL填充
linePaint.setColor(lineColor);
linePaint.setStrokeWidth(dip2px(lineWidthDP));//边框宽度
pointPaint = new Paint();
pointPaint.setAntiAlias(true);
pointPaint.setStyle(Paint.Style.FILL);
pointPaint.setColor(pointColor);
pointPaint.setStrokeWidth(dip2px(pointWidthDP));
tablePaint = new Paint();
tablePaint.setAntiAlias(true);
tablePaint.setStyle(Paint.Style.STROKE);
tablePaint.setColor(tableColor);
tablePaint.setStrokeWidth(dip2px(tableWidthDP));
textRulerPaint = new Paint();
textRulerPaint.setAntiAlias(true);
textRulerPaint.setStyle(Paint.Style.FILL);
textRulerPaint.setTextAlign(Paint.Align.CENTER);
textRulerPaint.setColor(rulerTextColor);//文本颜色
textRulerPaint.setTextSize(sp2px(rulerTextSizeSP));//字体大小
textPointPaint = new Paint();
textPointPaint.setAntiAlias(true);
textPointPaint.setStyle(Paint.Style.FILL);
textPointPaint.setTextAlign(Paint.Align.CENTER);
textPointPaint.setColor(pointTextColor);//文本颜色
textPointPaint.setTextSize(sp2px(pointTextSizeSP));//字体大小
linePath = new Path();
tablePath = new Path();
resetParam();
}
示例15: updateMarkerColor
import android.graphics.Paint; //导入方法依赖的package包/类
/**
* updates the paint of the marker
*/
private void updateMarkerColor() {
mMarkerColorPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mMarkerColorPaint.setColor(mProgressBackgroundColor);
mMarkerColorPaint.setStyle(Paint.Style.STROKE);
mMarkerColorPaint.setStrokeWidth(mCircleStrokeWidth / 2);
invalidate();
}