面试宝典
面试必问知识点、BATJ历年历年面试真题+解析
学习经验总结
(一)调整好心态
心态是一个人能否成功的关键,如果不调整好自己的心态,是很难静下心来学习的,尤其是现在这么浮躁的社会,大部分的程序员的现状就是三点一线,感觉很累,一些大龄的程序员更多的会感到焦虑,而且随着年龄的增长,这种焦虑感会越来越强烈,那么唯一的解决办法就是调整好自己的心态,要做到自信、年轻、勤奋。这样的调整,一方面对自己学习有帮助,另一方面让自己应对面试更从容,更顺利。
(二)时间挤一挤,制定好计划
一旦下定决心要提升自己,那么再忙的情况下也要每天挤一挤时间,切记不可“两天打渔三天晒网”。另外,制定好学习计划也是很有必要的,有逻辑有条理的复习,先查漏补缺,然后再系统复习,这样才能够做到事半功倍,效果才会立竿见影。
(三)不断学习技术知识,更新自己的知识储备
对于一名程序员来说,技术知识方面是非常重要的,可以说是重中之重。**要面试大厂,自己的知识储备一定要非常丰富,若缺胳膊少腿,别说在实际工作当中,光是面试这一关就过不了。**对于技术方面,首先基础知识一定要扎实,包括自己方向的语言基础、计算机基础、算法以及编程等等。
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
private Integer mImagesId[] = {
R.drawable.ic_1,
R.drawable.ic_3,
R.drawable.ic_2,
R.drawable.ic_4,
R.drawable.ic_5
};
三:gallery 控件类
缩放,还有透明,等等都在这里设置
public class FancyCoverFlow extends Gallery {
public static final int ACTION_DISTANCE_AUTO = Integer.MAX_VALUE;
/**
- 图片向上突出,可以通过代码控制,也可以在xml上控制
*/
public static final float SCALEDOWN_GRAVITY_TOP = 0.0f;
/**
- 图片中间突出
*/
public static final float SCALEDOWN_GRAVITY_CENTER = 0.5f;
/**
- 图片向下突出
*/
public static final float SCALEDOWN_GRAVITY_BOTTOM = 1.0f;
private float reflectionRatio = 0.3f;
private int reflectionGap = 4;
private boolean reflectionEnabled = false;
private float unselectedAlpha;
private Camera transformationCamera;
private int maxRotation = 0;
private float unselectedScale;
private float scaleDownGravity = SCALEDOWN_GRAVITY_CENTER;
private int actionDistance;
private float unselectedSaturation;
public FancyCoverFlow(Context context) {
super(context);
this.initialize();
}
public FancyCoverFlow(Context context, AttributeSet attrs) {
super(context, attrs);
this.initialize();
this.applyXmlAttributes(attrs);
}
@SuppressLint(“NewApi”)
public FancyCoverFlow(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
if (Build.VERSION.SDK_INT >= 11) {
this.setLayerType(LAYER_TYPE_SOFTWARE, null);
}
this.initialize();
this.applyXmlAttributes(attrs);
}
private void initialize() {
this.transformationCamera = new Camera();
this.setSpacing(0);
}
private void applyXmlAttributes(AttributeSet attrs) {
TypedArray a = getContext().obtainStyledAttributes(attrs,
R.styleable.FancyCoverFlow);
this.actionDistance = a
.getInteger(R.styleable.FancyCoverFlow_actionDistance,
ACTION_DISTANCE_AUTO);
this.scaleDownGravity = a.getFloat(
R.styleable.FancyCoverFlow_scaleDownGravity, 0.5f);
this.maxRotation = a.getInteger(R.styleable.FancyCoverFlow_maxRotation,
0);
this.unselectedAlpha = a.getFloat(
R.styleable.FancyCoverFlow_unselectedAlpha, 0.5f);
this.unselectedSaturation = a.getFloat(
R.styleable.FancyCoverFlow_unselectedSaturation, 0.0f);
this.unselectedScale = a.getFloat(
R.styleable.FancyCoverFlow_unselectedScale, 0.75f);
}
public float getReflectionRatio() {
return reflectionRatio;
}
public void setReflectionRatio(float reflectionRatio) {
if (reflectionRatio <= 0 || reflectionRatio > 0.5f) {
throw new IllegalArgumentException(
“reflectionRatio may only be in the interval (0, 0.5]”);
}
this.reflectionRatio = reflectionRatio;
if (this.getAdapter() != null) {
((FancyCoverFlowAdapter) this.getAdapter()).notifyDataSetChanged();
}
}
public int getReflectionGap() {
return reflectionGap;
}
public void setReflectionGap(int reflectionGap) {
this.reflectionGap = reflectionGap;
if (this.getAdapter() != null) {
((FancyCoverFlowAdapter) this.getAdapter()).notifyDataSetChanged();
}
}
public boolean isReflectionEnabled() {
return reflectionEnabled;
}
public void setReflectionEnabled(boolean reflectionEnabled) {
this.reflectionEnabled = reflectionEnabled;
if (this.getAdapter() != null) {
((FancyCoverFlowAdapter) this.getAdapter()).notifyDataSetChanged();
}
}
@Override
public void setAdapter(SpinnerAdapter adapter) {
if (!(adapter instanceof FancyCoverFlowAdapter)) {
throw new ClassCastException(FancyCoverFlow.class.getSimpleName()
-
" only works in conjunction with a "
-
FancyCoverFlowAdapter.class.getSimpleName());
}
super.setAdapter(adapter);
}
public int getMaxRotation() {
return maxRotation;
}
public void setMaxRotation(int maxRotation) {
this.maxRotation = maxRotation;
}
public float getUnselectedAlpha() {
return this.unselectedAlpha;
}
public float getUnselectedScale() {
return unselectedScale;
}
public void setUnselectedScale(float unselectedScale) {
this.unselectedScale = unselectedScale;
}
public float getScaleDownGravity() {
return scaleDownGravity;
}
public void setScaleDownGravity(float scaleDownGravity) {
this.scaleDownGravity = scaleDownGravity;
}
public int getActionDistance() {
return actionDistance;
}
public void setActionDistance(int actionDistance) {
this.actionDistance = actionDistance;
}
@Override
public void setUnselectedAlpha(float unselectedAlpha) {
super.setUnselectedAlpha(unselectedAlpha);
this.unselectedAlpha = unselectedAlpha;
}
public float getUnselectedSaturation() {
return unselectedSaturation;
}
public void setUnselectedSaturation(float unselectedSaturation) {
this.unselectedSaturation = unselectedSaturation;
}
public int preLeftOffset = 0;
public int count = 0;
public boolean isPlayDraw = true;
@Override
protected boolean getChildStaticTransformation(View child, Transformation t) {
FancyCoverFlowItemWrapper item = (FancyCoverFlowItemWrapper) child;
preLeftOffset = getChildAt(0).getLeft();
if (android.os.Build.VERSION.SDK_INT >= 16) {
item.postInvalidate();
}
final int coverFlowWidth = this.getWidth();
final int coverFlowCenter = coverFlowWidth / 2;
final int childWidth = item.getWidth();
final int childHeight = item.getHeight();
final int childCenter = item.getLeft() + childWidth / 2;
-
final int actionDistance = (this.actionDistance == ACTION_DISTANCE_AUTO) ? (int) ((coverFlowWidth + childWidth) / 2.0f)
- this.actionDistance;
float effectsAmount = Math.min(
1.0f,
Math.max(-1.0f, (1.0f / actionDistance)
- (childCenter - coverFlowCenter)));
t.clear();
t.setTransformationType(Transformation.TYPE_BOTH);
if (this.unselectedAlpha != 1) {
final float alphaAmount = (this.unselectedAlpha - 1)
- Math.abs(effectsAmount) + 1;
t.setAlpha(alphaAmount);
}
if (this.unselectedSaturation != 1) {
// Pass over saturation to the wrapper.
final float saturationAmount = (this.unselectedSaturation - 1)
- Math.abs(effectsAmount) + 1;
item.setSaturation(saturationAmount);
}
final Matrix imageMatrix = t.getMatrix();
// 旋转角度不为0则开始图片旋转.
if (this.maxRotation != 0) {
final int rotationAngle = (int) (-effectsAmount * this.maxRotation);
this.transformationCamera.save();
this.transformationCamera.rotateY(rotationAngle);
this.transformationCamera.getMatrix(imageMatrix);
this.transformationCamera.restore();
}
// 缩放.
if (this.unselectedScale != 1) {
final float zoomAmount = 1f / 2f * (1 - Math.abs(effectsAmount))
-
(1 - Math.abs(effectsAmount))
-
(1 - Math.abs(effectsAmount)) + 0.5f;
final float translateX = childWidth / 2.0f;
final float translateY = childHeight * this.scaleDownGravity;
imageMatrix.preTranslate(-translateX, -translateY);
imageMatrix.postScale(zoomAmount, zoomAmount);
imageMatrix.postTranslate(translateX, translateY);
if (effectsAmount != 0) {
double point = 0.4;
double translateFactor = (-1f / (point * point)
-
(Math.abs(effectsAmount) - point)
-
(Math.abs(effectsAmount) - point) + 1)
-
(effectsAmount > 0 ? 1 : -1);
imageMatrix
.postTranslate(
(float) (ViewUtil.Dp2Px(getContext(), 25) * translateFactor),
0);
}
}
return true;
}
// 绘制顺序,先从左到中间,再从右到中间
@Override
protected int getChildDrawingOrder(int childCount, int i) {
int selectedIndex = getSelectedItemPosition()
- getFirstVisiblePosition();
if (i < selectedIndex) {
return i;
} else if (i >= selectedIndex) {
return childCount - 1 - i + selectedIndex;
} else {
return i;
}
}
private boolean isTouchAble = true;
public void disableTouch() {
isTouchAble = false;
}
public void enableTouch() {
isTouchAble = true;
}
public boolean isTouchAble() {
return isTouchAble;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
count = 0;
for (int i = 0; i < getChildCount(); i++) {
getChildAt(i).invalidate();
}
if (isTouchAble) {
return super.onTouchEvent(event);
} else {
return false;
}
}
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
if (isTouchAble) {
return super.onInterceptTouchEvent(event);
} else {
return true;
}
}
//
// @Override
// public boolean onSingleTapUp(MotionEvent e) {
// return false;
// }
// 使快速滑动失效
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {
return false;
}
四:倒影
reflectionGap 处理图片和倒影之间的间距。
/**
- grallery 倒影放大操作类
*/
public class MyImgView {
/**
-
添加倒影,原理,先翻转图片,由上到下放大透明度
-
@param originalImage
-
@return
*/
public static Bitmap createReflectedImage(Bitmap originalImage) {
// The gap we want between the reflection and the original image
final int reflectionGap = 4;
int width = originalImage.getWidth();
int height = originalImage.getHeight();
// This will not scale but will flip on the Y axis
Matrix matrix = new Matrix();
matrix.preScale(1, -1);
// Create a Bitmap with the flip matrix applied to it.
// We only want the bottom half of the image
Bitmap reflectionImage = Bitmap.createBitmap(originalImage, 0,
height / 2, width, height / 2, matrix, false);
// Create a new bitmap with same width but taller to fit reflection
Bitmap bitmapWithReflection = Bitmap.createBitmap(width,
(height + height /4), Config.ARGB_8888);
// Create a new Canvas with the bitmap that’s big enough for
// the image plus gap plus reflection
Canvas canvas = new Canvas(bitmapWithReflection);
最后
对于很多初中级Android工程师而言,想要提升技能,往往是自己摸索成长,不成体系的学习效果低效漫长且无助。整理的这些架构技术希望对Android开发的朋友们有所参考以及少走弯路,本文的重点是你有没有收获与成长,其余的都不重要,希望读者们能谨记这一点。
同时我经过多年的收藏目前也算收集到了一套完整的学习资料以及高清详细的Android架构进阶学习导图及笔记分享给大家,希望对想成为架构师的朋友有一定的参考和帮助。
下面是部分资料截图,诚意满满:特别适合有开发经验的Android程序员们学习。
不论遇到什么困难,都不应该成为我们放弃的理由!
如果你看到了这里,觉得文章写得不错就给个赞呗?如果你觉得那里值得改进的,请给我留言,一定会认真查询,修正不足,谢谢。
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
/4), Config.ARGB_8888);
// Create a new Canvas with the bitmap that’s big enough for
// the image plus gap plus reflection
Canvas canvas = new Canvas(bitmapWithReflection);
最后
对于很多初中级Android工程师而言,想要提升技能,往往是自己摸索成长,不成体系的学习效果低效漫长且无助。整理的这些架构技术希望对Android开发的朋友们有所参考以及少走弯路,本文的重点是你有没有收获与成长,其余的都不重要,希望读者们能谨记这一点。
同时我经过多年的收藏目前也算收集到了一套完整的学习资料以及高清详细的Android架构进阶学习导图及笔记分享给大家,希望对想成为架构师的朋友有一定的参考和帮助。
下面是部分资料截图,诚意满满:特别适合有开发经验的Android程序员们学习。
[外链图片转存中…(img-7DMUF8NQ-1714996370710)]
不论遇到什么困难,都不应该成为我们放弃的理由!
如果你看到了这里,觉得文章写得不错就给个赞呗?如果你觉得那里值得改进的,请给我留言,一定会认真查询,修正不足,谢谢。
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!