-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
下面把所有的代码都给大家:
Activity中的代码
public class Recycler_variety_Activity extends Activity { private int[] icons = {R.drawable.test, R.drawable.test1, R.drawable.test2, R.drawable.test3, R.drawable.test4, R.drawable.test5, R.drawable.test6}; private RecyclerView mRecy; private List<MoreTypeBean> mData; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.recycler_variety_activity); initView(); initData(); initViewOper(); } private void initView() { mRecy = (RecyclerView) findViewById(R.id.act_recycler_variety_recycler); } private void initData() { mData = new ArrayList<>(); // 随机数 用来标记item界面的类型 Random random = new Random(); for (int i = 0; i < icons.length; i++) { MoreTypeBean more = new MoreTypeBean(); more.pic = icons[i]; more.type = random.nextInt(3); mData.add(more); } } private void initViewOper() { LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); mRecy.setLayoutManager(linearLayoutManager); Recycler_variety_Adapter adapter = new Recycler_variety_Adapter(mData); mRecy.setAdapter(adapter); } }
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
recyclerview_test_layout的布局就是只有一个RecyclerView
<android.support.v7.widget.RecyclerView android:id="@+id/act_recycler_variety_recycler" android:layout_width="match_parent" android:background="#d3d3d3" android:layout_height="match_parent"/>
-
1
-
2
-
3
-
4
-
5
RecyclerView的Adapter
public class Recycler_variety_Adapter extends RecyclerView.Adapter { //定义三种常量 表示三种条目类型 public static final int TYPE_PULL_IMAGE = 0; public static final int TYPE_RIGHT_IMAGE = 1; public static final int TYPE_THREE_IMAGE = 2; private List<MoreTypeBean> mData; public Recycler_variety_Adapter(List<MoreTypeBean> data) { this.mData = data; } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { //创建不同的 ViewHolder View view; //根据viewtype来创建条目 if (viewType == TYPE_PULL_IMAGE) { view =View.inflate(parent.getContext(),R.layout.item_pull_img,null); return new PullImageHolder(view); } else if (viewType == TYPE_RIGHT_IMAGE) { view =View.inflate(parent.getContext(),R.layout.item_right_img,null); return new RightImageHolder(view); } else { view =View.inflate(parent.getContext(),R.layout.item_three_img,null); return new ThreeImageHolder(view); } } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { } @Override public int getItemCount() { if (mData != null) { return mData.size(); } return 0; } //根据条件返回条目的类型 @Override public int getItemViewType(int position) { MoreTypeBean moreTypeBean = mData.get(position); if (moreTypeBean.type == 0) { return TYPE_PULL_IMAGE; } else if (moreTypeBean.type == 1) { return TYPE_RIGHT_IMAGE; } else { return TYPE_THREE_IMAGE; } } /** * 创建三种ViewHolder */ private class PullImageHolder extends RecyclerView.ViewHolder { public PullImageHolder(View itemView) { super(itemView); } } private class RightImageHolder extends RecyclerView.ViewHolder { public RightImageHolder(View itemView) { super(itemView); } } private class ThreeImageHolder extends RecyclerView.ViewHolder { public ThreeImageHolder(View itemView) { super(itemView); } } }
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
item_pull_img布局
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:padding="7dp" android:background="#fff" android:orientation="vertical" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000" android:text="多种条目类型,多种条目类型,多种条目类型,多种条目类型,多种条目类型" android:textSize="16sp" /> <ImageView android:layout_width="match_parent" android:layout_height="150dp" android:background="@drawable/sucai6" android:scaleType="fitXY" /> </LinearLayout> <View android:layout_marginTop="3dp" android:layout_width="match_parent" android:layout_height="1dp" android:background="#d3d3d3" /> </LinearLayout>
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
item_right_img布局
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="100dp" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#fff" android:orientation="horizontal" android:padding="7dp"> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="多种条目类型,多种条目类型,多种条目类型,多种条目类型,多种条目类型,多种条目类型,多种条目类型,多种条目类型" android:textColor="#000" android:textSize="16sp" /> <ImageView android:layout_width="120dp" android:layout_height="90dp" android:background="@drawable/sucai" /> </LinearLayout> <View android:layout_marginTop="3dp" android:layout_width="match_parent" android:layout_height="1dp" android:background="#d3d3d3" /> </LinearLayout>
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
item_three_img布局
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:background="#fff" android:padding="7sp" android:layout_height="wrap_content"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="多种条目类型,多种条目类型,多种条目类型,多种条目类型,多种条目类型,多种条目类型多种条目类型" android:textColor="#000" android:textSize="16sp" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <ImageView android:layout_width="0dp" android:layout_height="80dp" android:layout_weight="1" android:scaleType="fitXY" android:src="@drawable/sucai3" /> <View android:layout_width="6dp" android:layout_height="0dp"/> <ImageView android:layout_width="0dp" android:layout_height="80dp" android:layout_weight="1" android:scaleType="fitXY" android:src="@drawable/sucai4" /> <View android:layout_width="6dp" android:layout_height="0dp"/> <ImageView android:layout_width="0dp" android:layout_height="80dp" android:layout_weight="1" android:scaleType="fitXY" android:src="@drawable/sucai5" /> </LinearLayout> </LinearLayout> <View android:layout_marginTop="3dp" android:background="#d3d3d3" android:layout_width="match_parent" android:layout_height="1dp"/> </LinearLayout>
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数初中级Android工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则近万的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Android移动开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Android开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!
如果你觉得这些内容对你有帮助,可以扫码获取!!(备注:Android)
![](https://i-blog.csdnimg.cn/blog_migrate/35d2c3f6bd26697c618033b8f8a9055d.jpeg)
总结
Android架构学习进阶是一条漫长而艰苦的道路,不能靠一时激情,更不是熬几天几夜就能学好的,必须养成平时努力学习的习惯。所以:贵在坚持!
上面分享的字节跳动公司2020年的面试真题解析大全,笔者还把一线互联网企业主流面试技术要点整理成了视频和PDF(实际上比预期多花了不少精力),包含知识脉络 + 诸多细节。
就先写到这,码字不易,写的很片面不好之处敬请指出,如果觉得有参考价值的朋友也可以关注一下我
①「Android面试真题解析大全」PDF完整高清版+②「Android面试知识体系」学习思维导图压缩包阅读下载,最后觉得有帮助、有需要的朋友可以点个赞
《互联网大厂面试真题解析、进阶开发核心学习笔记、全套讲解视频、实战项目源码讲义》点击传送门即可获取!
mg src=“https://i-blog.csdnimg.cn/blog_migrate/35d2c3f6bd26697c618033b8f8a9055d.jpeg” />
总结
Android架构学习进阶是一条漫长而艰苦的道路,不能靠一时激情,更不是熬几天几夜就能学好的,必须养成平时努力学习的习惯。所以:贵在坚持!
上面分享的字节跳动公司2020年的面试真题解析大全,笔者还把一线互联网企业主流面试技术要点整理成了视频和PDF(实际上比预期多花了不少精力),包含知识脉络 + 诸多细节。
就先写到这,码字不易,写的很片面不好之处敬请指出,如果觉得有参考价值的朋友也可以关注一下我
①「Android面试真题解析大全」PDF完整高清版+②「Android面试知识体系」学习思维导图压缩包阅读下载,最后觉得有帮助、有需要的朋友可以点个赞
[外链图片转存中…(img-nPCvldAP-1712794226066)]
[外链图片转存中…(img-ZGcpSUx4-1712794226066)]
[外链图片转存中…(img-L7eb4FHw-1712794226066)]
《互联网大厂面试真题解析、进阶开发核心学习笔记、全套讲解视频、实战项目源码讲义》点击传送门即可获取!