}
public MySuccessView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public MySuccessView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(attrs);
}
private void init(AttributeSet attrs) {
TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.SuccessView);
int pColor = typedArray.getColor(R.styleable.SuccessView_svStrokeColor, 0xffA5DC86);
float strokeWidth = typedArray.getFloat(R.styleable.SuccessView_svStrokeWidth, 2.5f);
typedArray.recycle(); //should recycle
minWidth = dip2px(50);
minHeight = dip2px(50);
mPaint = new Paint();
mPaint.setColor(pColor);
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
mPaint.setStrokeWidth(0.8f);
mPaint.setAntiAlias(true);
nPaint = new Paint();
nPaint.setAntiAlias(true);
nPaint.setStyle(Paint.Style.STROKE);
nPaint.setStrokeWidth(dip2px(strokeWidth));
nPaint.setColor(pColor);
}
@Override
protected void onDraw(Canvas canvas) {
Rect bounds = canvas.getClipBounds();
float left, right, top, bottom;
if (bounds.width() > bounds.height()) {
float distance = (bounds.width() / 2 - bounds.height() / 2);
left = bounds.left + distance;
right = bounds.right - distance;
top = bounds.top;
bottom = bounds.bottom;
} else if (bounds.width() < bounds.height()) {
float distance = (bounds.height() / 2 - bounds.width() / 2);
top = bounds.top + distance;
bottom = bounds.bottom - distance;
left = bounds.left;
right = bounds.right;
} else {
left = bounds.left;
right = bounds.right;
top = bounds.top;
bottom = bounds.bottom;
}
RectF oval = new RectF(left + dip2px(2f), top + dip2px(2f), right - dip2px(2f), bottom - dip2px(2f));
canvas.drawArc(oval, startAngle, angle, false, nPaint);
int totalW = getWidth();
int totalH = getHeight();
canvas.rotate(45, totalW / 2, totalH / 2);
totalW /= 1.2;
totalH /= 1.4;
RectF leftRect = new RectF();
if (mLeftRectWidth > 0) {
leftRect.left = (totalW - CONST_LEFT_RECT_W) / 2 + CONST_RECT_WEIGHT;
leftRect.right = leftRect.left + dip2px(mLeftRectWidth);
leftRect.top = (totalH + CONST_RIGHT_RECT_W) / 2;
leftRect.bottom = leftRect.top + CONST_RECT_WEIGHT;
canvas.drawRoundRect(leftRect, CONST_RADIUS, CONST_RADIUS, mPaint);
}
if (mRightRectWidth > 0) {
RectF rightRect = new RectF();
rightRect.bottom = (totalH + CONST_RIGHT_RECT_W) / 2 + CONST_RECT_WEIGHT - 1;
rightRect.left = (totalW + CONST_LEFT_RECT_W) / 2;
rightRect.right = rightRect.left + CONST_RECT_WEIGHT;
rightRect.top = rightRect.bottom - dip2px(mRightRectWidth);
canvas.drawRoundRect(rightRect, CONST_RADIUS, CONST_RADIUS, mPaint);
}
super.onDraw(canvas);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
int width;
int height;
if (widthMode == MeasureSpec.EXACTLY) {
width = widthSize;
} else {
width = (int) (getPaddingLeft() + minWidth + getPaddingRight());
}
if (heightMode == MeasureSpec.EXACTLY) {
height = heightSize;
} else {
height = (int) (getPaddingTop() + minHeight + getPaddingBottom());
}
setMeasuredDimension(width, height);
}
public float dip2px(float dpValue) {
if (mDensity == -1) {
mDensity = getResources().getDisplayMetrics().density;
}
return dpValue * mDensity + 0.5f;
}
总结
学习技术是一条慢长而艰苦的道路,不能靠一时激情,也不是熬几天几夜就能学好的,必须养成平时努力学习的习惯。所以:贵在坚持!
最后如何才能让我们在面试中对答如流呢?
答案当然是平时在工作或者学习中多提升自身实力的啦,那如何才能正确的学习,有方向的学习呢?有没有免费资料可以借鉴?为此我整理了一份Android学习资料路线:
这里是一部分我工作以来以及参与过的大大小小的面试收集总结出来的一套BAT大厂面试资料专题包,主要还是希望大家在如今大环境不好的情况下面试能够顺利一点,希望可以帮助到大家。
好了,今天的分享就到这里,如果你对在面试中遇到的问题,或者刚毕业及工作几年迷茫不知道该如何准备面试并突破现状提升自己,对于自己的未来还不够了解不知道给如何规划。来看看同行们都是如何突破现状,怎么学习的,来吸收他们的面试以及工作经验完善自己的之后的面试计划及职业规划。
最后,祝愿即将跳槽和已经开始求职的大家都能找到一份好的工作!
这些只是整理出来的部分面试题,后续会持续更新,希望通过这些高级面试题能够降低面试Android岗位的门槛,让更多的Android工程师理解Android系统,掌握Android系统。喜欢的话麻烦点击一个喜欢再关注一下~
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
droid系统。喜欢的话麻烦点击一个喜欢再关注一下~
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!