前言
“2020年技术没有成长,我今年一定要好好努力学习!”
“在现在这个公司都工作了3年了,一毛钱工资都没有涨…”
“年前真倒霉,老板嫌我工资高,被优化了,年后又遇到了疫情,现在都还没有找到合适的工作。”
“想一边工作,一边找工作,但是,哎,要么简历石沉大海,要么,问几个问题就结束了…”
“刚找到一个工作,这工资比我现在的也高不了多少,去还是不去呢?”
“工作这么多年了,感觉技术就是这样子,这几年时间白白浪费了”
“越想越觉得自己的干这个技术没有出路,我该怎么办啊,换行业吗,还是继续干,不干我又能干什么呢?”
经常能听到一些Android同僚发出这样的言论,很多人都对自己的职业和未来感觉迷茫,想要学习提升自己,但是又不知道该如何去学习,或者沉不下心来学习。
既然选择了Android,就注定要不断学习新技术,没技术、没能力还不学习,被淘汰的时候怨不得别人。
/**
- 更改RecyclerView滚动的速度
*/
public class ScollLinearLayoutManager extends LinearLayoutManager {
private float MILLISECONDS_PER_INCH = 25f; //修改可以改变数据,越大速度越慢
private Context contxt;
public ScollLinearLayoutManager(Context context) {
super(context);
this.contxt = context;
}
@Override
public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, int position) {
LinearSmoothScroller linearSmoothScroller =
new LinearSmoothScroller(recyclerView.getContext()) {
@Override
public PointF computeScrollVectorForPosition(int targetPosition) {
return ScollLinearLayoutManager.this
.computeScrollVectorForPosition(targetPosition);
}
@Override
protected float calculateSpeedPerPixel
(DisplayMetrics displayMetrics) {
return MILLISECONDS_PER_INCH / displayMetrics.density;
//返回滑动一个pixel需要多少毫秒
}
};
linearSmoothScroller.setTargetPosition(position);
startSmoothScroll(linearSmoothScroller);
}
//可以用来设置速度
public void setSpeedSlow(float x) {
//自己在这里用density去乘,希望不同分辨率设备上滑动速度相同
//0.3f是自己估摸的一个值,可以根据不同需求自己修改
MILLISECONDS_PER_INCH = contxt.getResources().getDisplayMetrics().density * 0.3f + (x);
}
}
3.图片宽度充满屏幕、高度按图片原始宽高比例自适应
@SuppressLint(“AppCompatCustomView”)
public class FitImageView extends ImageView {
public FitImageView(Context context) {
super(context);
}
public FitImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){
Drawable drawable = getDrawable();
if(drawable!=null){
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = (int) Math.ceil((float) width * (float) drawable.getIntrinsicHeight() / (float) drawable.getIntrinsicWidth());
setMeasuredDimension(width, height);
}else{
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
}
4.这里需要注意的是、Item的根布局android:layout_height=“wrap_content”,否则图片高度会受限
<android.support.constraint.ConstraintLayout xmlns:android=“http://schemas.android.com/apk/res/android”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”>
<com.next.scrollimagedemo.view.FitImageView
android:id=“@+id/item_bg”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:src=“@mipmap/ww1” />
</android.support.constraint.ConstraintLayout>
5. 使RecyclerView不能手指触碰滑动
加层View屏蔽掉事件就好了
<android.support.constraint.ConstraintLayout xmlns:android=“http://schemas.android.com/apk/res/android”
xmlns:app=“http://schemas.android.com/apk/res-auto”
xmlns:tools=“http://schemas.android.com/tools”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
tools:context=“.MainActivity”>
<android.support.v7.widget.RecyclerView
android:id=“@+id/mRecyclerView”
android:layout_width=“match_parent”
《Android学习笔记总结+最新移动架构视频+大厂安卓面试真题+项目实战源码讲义》开源
最后:学习总结——Android框架体系架构知识脑图(纯手绘xmind文档)
学完之后,若是想验收效果如何,其实最好的方法就是可自己去总结一下。比如我就会在学习完一个东西之后自己去手绘一份xmind文件的知识梳理大纲脑图,这样也可方便后续的复习,且都是自己的理解,相信随便瞟几眼就能迅速过完整个知识,脑补回来。
下方即为我手绘的Android框架体系架构知识脑图,由于是xmind文件,不好上传,所以小编将其以图片形式导出来传在此处,细节方面不是特别清晰。但可给感兴趣的朋友提供完整的Android框架体系架构知识脑图原件(包括上方的面试解析xmind文档)
除此之外,前文所提及的Alibaba珍藏版 Android框架体系架构 手写文档以及一本 《大话数据结构》 书籍等等相关的学习笔记文档,也皆可分享给认可的朋友!
——感谢大家伙的认可支持,请注意:点赞+点赞+点赞!!!
mg-4QEupKYQ-1649671562498)]
除此之外,前文所提及的Alibaba珍藏版 Android框架体系架构 手写文档以及一本 《大话数据结构》 书籍等等相关的学习笔记文档,也皆可分享给认可的朋友!
——感谢大家伙的认可支持,请注意:点赞+点赞+点赞!!!