2024年Android最新Android 自定义ProgressBar显示百分比,2024年最新面试三面之后多久有结果

总结

其实要轻松掌握很简单,要点就两个:

  1. 找到一套好的视频资料,紧跟大牛梳理好的知识框架进行学习。
  2. 多练。 (视频优势是互动感强,容易集中注意力)

你不需要是天才,也不需要具备强悍的天赋,只要做到这两点,短期内成功的概率是非常高的。

对于很多初中级Android工程师而言,想要提升技能,往往是自己摸索成长,不成体系的学习效果低效漫长且无助。

以上就是总结的关于在面试的一些总结,希望对大家能有些帮助,除了这些面试中需要注意的问题,当然最重要的就是刷题了,这里放上我之前整理的一份超全的面试专题PDF

还有 高级架构技术进阶脑图、Android开发面试专题资料,高级进阶架构资料 帮助大家学习提升进阶,也节省大家在网上搜索资料的时间来学习,也可以分享给身边好友一起学习。

【Android核心高级技术PDF文档,BAT大厂面试真题解析】

这里只是整理出来的部分面试题,后续会持续更新,希望通过这些高级面试题能够降低面试Android岗位的门槛,让更多的Android工程师理解Android系统,掌握Android系统。喜欢的话麻烦点击一个喜欢在关注一下~

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化学习资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

private float mUnreachedBarHeight;

/**

  • The suffix of the number.

*/

private String mSuffix = “%”;

/**

  • The prefix.

*/

private String mPrefix = “”;

private final int default_text_color = Color.rgb(66, 145, 241);

private final int default_reached_color = Color.rgb(66, 145, 241);

private final int default_unreached_color = Color.rgb(204, 204, 204);

private final float default_progress_text_offset;

private final float default_text_size;

private final float default_reached_bar_height;

private final float default_unreached_bar_height;

/**

  • For save and restore instance of progressbar.

*/

private static final String INSTANCE_STATE = “saved_instance”;

private static final String INSTANCE_TEXT_COLOR = “text_color”;

private static final String INSTANCE_TEXT_SIZE = “text_size”;

private static final String INSTANCE_REACHED_BAR_HEIGHT = “reached_bar_height”;

private static final String INSTANCE_REACHED_BAR_COLOR = “reached_bar_color”;

private static final String INSTANCE_UNREACHED_BAR_HEIGHT = “unreached_bar_height”;

private static final String INSTANCE_UNREACHED_BAR_COLOR = “unreached_bar_color”;

private static final String INSTANCE_MAX = “max”;

private static final String INSTANCE_PROGRESS = “progress”;

private static final String INSTANCE_SUFFIX = “suffix”;

private static final String INSTANCE_PREFIX = “prefix”;

private static final String INSTANCE_TEXT_VISIBILITY = “text_visibility”;

private static final int PROGRESS_TEXT_VISIBLE = 0;

/**

  • The width of the text that to be drawn.

*/

private float mDrawTextWidth;

/**

  • The drawn text start.

*/

private float mDrawTextStart;

/**

  • The drawn text end.

*/

private float mDrawTextEnd;

/**

  • The text that to be drawn in onDraw().

*/

private String mCurrentDrawText;

/**

  • The Paint of the reached area.

*/

private Paint mReachedBarPaint;

/**

  • The Paint of the unreached area.

*/

private Paint mUnreachedBarPaint;

/**

  • The Paint of the progress text.

*/

private Paint mTextPaint;

/**

  • Unreached bar area to draw rect.

*/

private RectF mUnreachedRectF = new RectF(0, 0, 0, 0);

/**

  • Reached bar area rect.

*/

private RectF mReachedRectF = new RectF(0, 0, 0, 0);

/**

  • The progress text offset.

*/

private float mOffset;

/**

  • Determine if need to draw unreached area.

*/

private boolean mDrawUnreachedBar = true;

private boolean mDrawReachedBar = true;

private boolean mIfDrawText = true;

/**

  • Listener

*/

private OnProgressBarListener mListener;

public enum ProgressTextVisibility {

Visible, Invisible

}

public ProgressBarWithPercent(Context context) {

this(context, null);

}

public ProgressBarWithPercent(Context context, AttributeSet attrs) {

this(context, attrs, 0);

}

public ProgressBarWithPercent(Context context, AttributeSet attrs,

int defStyleAttr) {

super(context, attrs, defStyleAttr);

default_reached_bar_height = dp2px(1.5f);

default_unreached_bar_height = dp2px(1.0f);

default_text_size = sp2px(10);

default_progress_text_offset = dp2px(3.0f);

// load styled attributes.

final TypedArray attributes = context.getTheme()

.obtainStyledAttributes(attrs,

R.styleable.ProgressBarWithPercent, defStyleAttr, 0);

mReachedBarColor = attributes.getColor(

R.styleable.ProgressBarWithPercent_progress_reached_color,

default_reached_color);

mUnreachedBarColor = attributes.getColor(

R.styleable.ProgressBarWithPercent_progress_unreached_color,

default_unreached_color);

mTextColor = attributes.getColor(

R.styleable.ProgressBarWithPercent_progress_text_color,

default_text_color);

mTextSize = attributes.getDimension(

R.styleable.ProgressBarWithPercent_progress_text_size,

default_text_size);

mReachedBarHeight = attributes.getDimension(

R.styleable.ProgressBarWithPercent_progress_reached_bar_height,

default_reached_bar_height);

mUnreachedBarHeight = attributes

.getDimension(

R.styleable.ProgressBarWithPercent_progress_unreached_bar_height,

default_unreached_bar_height);

mOffset = attributes.getDimension(

R.styleable.ProgressBarWithPercent_progress_text_offset,

default_progress_text_offset);

int textVisible = attributes.getInt(

R.styleable.ProgressBarWithPercent_progress_text_visibility,

PROGRESS_TEXT_VISIBLE);

if (textVisible != PROGRESS_TEXT_VISIBLE) {

mIfDrawText = false;

}

setProgress(attributes.getInt(

R.styleable.ProgressBarWithPercent_progress_current, 0));

setMax(attributes.getInt(

R.styleable.ProgressBarWithPercent_progress_max, 100));

attributes.recycle();

initializePainters();

}

@Override

protected int getSuggestedMinimumWidth() {

return (int) mTextSize;

}

@Override

protected int getSuggestedMinimumHeight() {

return Math.max((int) mTextSize,

Math.max((int) mReachedBarHeight, (int) mUnreachedBarHeight));

}

@Override

protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {

setMeasuredDimension(measure(widthMeasureSpec, true),

measure(heightMeasureSpec, false));

}

private int measure(int measureSpec, boolean isWidth) {

int result;

int mode = MeasureSpec.getMode(measureSpec);

int size = MeasureSpec.getSize(measureSpec);

int padding = isWidth ? getPaddingLeft() + getPaddingRight()
getPaddingTop() + getPaddingBottom();

if (mode == MeasureSpec.EXACTLY) {

result = size;

} else {

result = isWidth ? getSuggestedMinimumWidth()
getSuggestedMinimumHeight();

result += padding;

if (mode == MeasureSpec.AT_MOST) {

if (isWidth) {

result = Math.max(result, size);

} else {

result = Math.min(result, size);

}

}

}

return result;

}

@Override

protected void onDraw(Canvas canvas) {

if (mIfDrawText) {

calculateDrawRectF();

} else {

calculateDrawRectFWithoutProgressText();

}

if (mDrawReachedBar) {

canvas.drawRect(mReachedRectF, mReachedBarPaint);

}

if (mDrawUnreachedBar) {

canvas.drawRect(mUnreachedRectF, mUnreachedBarPaint);

}

if (mIfDrawText)

canvas.drawText(mCurrentDrawText, mDrawTextStart, mDrawTextEnd,

mTextPaint);

}

private void initializePainters() {

mReachedBarPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

mReachedBarPaint.setColor(mReachedBarColor);

mUnreachedBarPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

mUnreachedBarPaint.setColor(mUnreachedBarColor);

mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

mTextPaint.setColor(mTextColor);

mTextPaint.setTextSize(mTextSize);

}

private void calculateDrawRectFWithoutProgressText() {

mReachedRectF.left = getPaddingLeft();

mReachedRectF.top = getHeight() / 2.0f - mReachedBarHeight / 2.0f;

mReachedRectF.right = (getWidth() - getPaddingLeft() - getPaddingRight())

/ (getMax() * 1.0f) * getProgress() + getPaddingLeft();

mReachedRectF.bottom = getHeight() / 2.0f + mReachedBarHeight / 2.0f;

mUnreachedRectF.left = mReachedRectF.right;

mUnreachedRectF.right = getWidth() - getPaddingRight();

mUnreachedRectF.top = getHeight() / 2.0f + -mUnreachedBarHeight / 2.0f;

mUnreachedRectF.bottom = getHeight() / 2.0f + mUnreachedBarHeight

/ 2.0f;

}

private void calculateDrawRectF() {

mCurrentDrawText = String.format(“%d”, getProgress() * 100 / getMax());

mCurrentDrawText = mPrefix + mCurrentDrawText + mSuffix;

mDrawTextWidth = mTextPaint.measureText(mCurrentDrawText);

if (getProgress() == 0) {

mDrawReachedBar = false;

mDrawTextStart = getPaddingLeft();

} else {

mDrawReachedBar = true;

mReachedRectF.left = getPaddingLeft();

mReachedRectF.top = getHeight() / 2.0f - mReachedBarHeight / 2.0f;

mReachedRectF.right = (getWidth() - getPaddingLeft() - getPaddingRight())

/ (getMax() * 1.0f)

  • getProgress()
  • mOffset
  • getPaddingLeft();

mReachedRectF.bottom = getHeight() / 2.0f + mReachedBarHeight

/ 2.0f;

mDrawTextStart = (mReachedRectF.right + mOffset);

}

mDrawTextEnd = (int) ((getHeight() / 2.0f) - ((mTextPaint.descent() + mTextPaint

.ascent()) / 2.0f));

if ((mDrawTextStart + mDrawTextWidth) >= getWidth() - getPaddingRight()) {

mDrawTextStart = getWidth() - getPaddingRight() - mDrawTextWidth;

mReachedRectF.right = mDrawTextStart - mOffset;

}

float unreachedBarStart = mDrawTextStart + mDrawTextWidth + mOffset;

if (unreachedBarStart >= getWidth() - getPaddingRight()) {

mDrawUnreachedBar = false;

} else {

mDrawUnreachedBar = true;

mUnreachedRectF.left = unreachedBarStart;

mUnreachedRectF.right = getWidth() - getPaddingRight();

mUnreachedRectF.top = getHeight() / 2.0f + -mUnreachedBarHeight

/ 2.0f;

mUnreachedRectF.bottom = getHeight() / 2.0f + mUnreachedBarHeight

/ 2.0f;

}

}

/**

  • Get progress text color.

  • @return progress text color.

*/

public int getTextColor() {

return mTextColor;

}

/**

  • Get progress text size.

  • @return progress text size.

*/

public float getProgressTextSize() {

return mTextSize;

}

public int getUnreachedBarColor() {

return mUnreachedBarColor;

}

public int getReachedBarColor() {

return mReachedBarColor;

}

public int getProgress() {

return mCurrentProgress;

}

public int getMax() {

return mMaxProgress;

}

尾声

最后,我再重复一次,如果你想成为一个优秀的 Android 开发人员,请集中精力,对基础和重要的事情做深度研究。

对于很多初中级Android工程师而言,想要提升技能,往往是自己摸索成长,不成体系的学习效果低效漫长且无助。 整理的这些架构技术希望对Android开发的朋友们有所参考以及少走弯路,本文的重点是你有没有收获与成长,其余的都不重要,希望读者们能谨记这一点。

最后想要拿高薪实现技术提升薪水得到质的飞跃。最快捷的方式,就是有人可以带着你一起分析,这样学习起来最为高效,所以为了大家能够顺利进阶中高级、架构师,我特地为大家准备了一套高手学习的源码和框架视频等精品Android架构师教程,保证你学了以后保证薪资上升一个台阶。

当你有了学习线路,学习哪些内容,也知道以后的路怎么走了,理论看多了总要实践的。

进阶学习视频

附上:我们之前因为秋招收集的二十套一二线互联网公司Android面试真题 (含BAT、小米、华为、美团、滴滴)和我自己整理Android复习笔记(包含Android基础知识点、Android扩展知识点、Android源码解析、设计模式汇总、Gradle知识点、常见算法题汇总。)

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化学习资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

有所参考以及少走弯路,本文的重点是你有没有收获与成长,其余的都不重要,希望读者们能谨记这一点。

最后想要拿高薪实现技术提升薪水得到质的飞跃。最快捷的方式,就是有人可以带着你一起分析,这样学习起来最为高效,所以为了大家能够顺利进阶中高级、架构师,我特地为大家准备了一套高手学习的源码和框架视频等精品Android架构师教程,保证你学了以后保证薪资上升一个台阶。

当你有了学习线路,学习哪些内容,也知道以后的路怎么走了,理论看多了总要实践的。

进阶学习视频

[外链图片转存中…(img-1iTMFWnT-1714962283588)]

附上:我们之前因为秋招收集的二十套一二线互联网公司Android面试真题 (含BAT、小米、华为、美团、滴滴)和我自己整理Android复习笔记(包含Android基础知识点、Android扩展知识点、Android源码解析、设计模式汇总、Gradle知识点、常见算法题汇总。)

[外链图片转存中…(img-LhW5jmim-1714962283588)]

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化学习资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

  • 13
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值