最后
在这里我和身边一些朋友特意整理了一份快速进阶为Android高级工程师的系统且全面的学习资料。涵盖了Android初级——Android高级架构师进阶必备的一些学习技能。
附上:我们之前因为秋招收集的二十套一二线互联网公司Android面试真题(含BAT、小米、华为、美团、滴滴)和我自己整理Android复习笔记(包含Android基础知识点、Android扩展知识点、Android源码解析、设计模式汇总、Gradle知识点、常见算法题汇总。)
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
android:layout_height=“match_parent”
android:background=“@android:color/white”
app:indexBar_selectedTextColor=“@color/black” //右侧导航选中时的颜色
app:indexBar_textColor=“@color/gray1” //右侧导航字体颜色
app:indexBar_layout_width=“40dp” //右侧导航的宽度
app:indexBar_textSize=“14sp” //右侧导航的字体大小
app:indexBar_textSpace=“5dp” />
在Activity中:
下面注释写的很清楚了,这里我就不多做说明了
public class CityPickerActivity extends AppCompatActivity {
//IndexableLayout 的适配器
private ContactAdapter mAdapter;
//自定义头部adapter
private BannerHeaderAdapter mBannerHeaderAdapter;
//热门城市的数组
private String[] city = {“东莞”,“深圳”,“广州”,“温州”,“郑州”,“金华”,“佛山”,“上海”,“苏州”,“杭州”,“长沙”,“中山”};
private IndexableLayout indexableLayout;
//热门城市的适配器
private CYBChangeCityGridViewAdapter cybChangeCityGridViewAdapter;
热门城市的集合
private ArrayList list;
//返回按钮
private ImageView pic_contact_back;
private Intent intent;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pick_contact);
initview();
initAdapter();
onlisten();
}
public void initAdapter(){
mAdapter = new ContactAdapter(this);
indexableLayout.setAdapter(mAdapter);
//设置字母提示框为仿os居中
indexableLayout.setOverlayStyle_Center();
mAdapter.setDatas(initDatas());
// indexableLayout.setOverlayStyle_MaterialDesign(Color.RED); 设置提示框为仿联系人气泡样式
// 全字母排序。排序规则设置为:每个字母都会进行比较排序;速度较慢
indexableLayout.setCompareMode(IndexableLayout.MODE_FAST);
// indexableLayout.addHeaderAdapter(new SimpleHeaderAdapter<>(mAdapter, “☆”,null, null));
// 构造函数里3个参数,分别对应 (IndexBar的字母索引, IndexTitle, 数据源), 不想显示哪个就传null, 数据源传null时,代表add一个普通的View
// mMenuHeaderAdapter = new MenuHeaderAdapter(“↑”, null, initMenuDatas());
// indexableLayout.addHeaderAdapter(mMenuHeaderAdapter);
// 这里BannerView只有一个Item, 添加一个长度为1的任意List作为第三个参数
List bannerList = new ArrayList<>();
bannerList.add(“”);
mBannerHeaderAdapter = new BannerHeaderAdapter(“↑”, null, bannerList);
indexableLayout.addHeaderAdapter(mBannerHeaderAdapter);
}
public void initview(){
intent = getIntent();
pic_contact_back = (ImageView) findViewById(R.id.pic_contact_back);
indexableLayout = (IndexableLayout) findViewById(R.id.indexableLayout);
indexableLayout.setLayoutManager(new LinearLayoutManager(this));
}
public void onlisten(){
pic_contact_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
mAdapter.setOnItemContentClickListener(new IndexableAdapter.OnItemContentClickListener() {
@Override
public void onItemClick(View v, int originalPosition, int currentPosition, UserEntity entity) {
if (originalPosition >= 0) {
intent.putExtra(“info”, entity.getNick());
setResult(RESULT_OK, intent);
finish();
} else {
ToastUtil.showShort(CityPickerActivity.this, “选中Header/Footer:” + entity.getNick() + " 当前位置:" + currentPosition);
}
}
});
}
/**
- 自定义的Banner Header
*/
class BannerHeaderAdapter extends IndexableHeaderAdapter {
private static final int TYPE = 1;
//这里传的参数上面注释有
public BannerHeaderAdapter(String index, String indexTitle, List datas) {
super(index, indexTitle, datas);
}
@Override
public int getItemViewType() {
return TYPE;
}
@Override
public RecyclerView.ViewHolder onCreateContentViewHolder(ViewGroup parent) {
View view = LayoutInflater.from(CityPickerActivity.this).inflate(R.layout.item_city_header, parent, false);
VH holder = new VH(view);
return holder;
}
@Override
public void onBindContentViewHolder(RecyclerView.ViewHolder holder, Object entity) {
// 数据源为null时, 该方法不用实现
VH vh = (VH) holder;
list=new ArrayList<>();
for(int i = 0; i<city.length; i++){
list.add(city[i]);
}
System.out.println(“------------city”+list);
cybChangeCityGridViewAdapter=new CYBChangeCityGridViewAdapter(CityPickerActivity.this, list);
// 绑定adpter
vh.head_home_change_city_gridview.setAdapter(cybChangeCityGridViewAdapter);
//热门城市的item点击事件
vh.head_home_change_city_gridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
intent.putExtra(“info”, list.get(position));
System.out.println(“aaaaaayyyyyyyyy”+list.get(position));
setResult(RESULT_OK, intent);
finish();
}
});
//设置定位城市的点击事件
vh.item_header_city_dw.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
intent.putExtra(“bendi”, MeNow.city);
setResult(RESULT_OK, intent);
finish();
}
});
}
private class VH extends RecyclerView.ViewHolder {
GridView head_home_change_city_gridview;
TextView item_header_city_dw;
public VH(View itemView) {
super(itemView);
head_home_change_city_gridview =(QGridView)itemView.findViewById(R.id.item_header_city_gridview);
item_header_city_dw = (TextView) itemView.findViewById(R.id.item_header_city_dw);
}
}
}
private List initDatas() {
List list = new ArrayList<>();
// 初始化数据,R.array.provinces是城市资源,下面有贴出资源文件代码
List contactStrings = Arrays.asList(getResources().getStringArray(R.array.provinces));
List mobileStrings = Arrays.asList(getResources().getStringArray(R.array.provinces));
for (int i = 0; i < contactStrings.size(); i++) {
UserEntity contactEntity = new UserEntity(contactStrings.get(i), mobileStrings.get(i));
list.add(contactEntity);
}
return list;
}
}
Activity的.xml文件中:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android=“http://schemas.android.com/apk/res/android”
xmlns:app=“http://schemas.android.com/apk/res-auto”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
android:orientation=“vertical”>
<LinearLayout
android:layout_width=“match_parent”
android:layout_height=“50dp”
android:orientation=“horizontal”
android:background=“@color/white”
android:elevation=“3dp”
<ImageView
android:id=“@+id/pic_contact_back”
android:layout_width=“50dp”
android:layout_height=“50dp”
android:src=“@drawable/back”
android:padding=“18dp”
/>
<TextView
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:text=“城市选择”
android:layout_gravity=“center_vertical”
android:textColor=“@color/black”
android:textSize=“18sp”
/>
<me.yokeyword.indexablerv.IndexableLayout
android:id=“@+id/indexableLayout”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
android:background=“@android:color/white”
app:indexBar_selectedTextColor=“@color/black”
app:indexBar_textColor=“@color/gray1”
app:indexBar_layout_width=“40dp”
app:indexBar_textSize=“14sp”
app:indexBar_textSpace=“5dp” />
values
目录下的R.arrays.xml
城市资源文件:
上海
北京
杭州
广州
…
BannerHeaderAdapter
其实就是相当于IndexableLayout
的头布局,我这里的定位城市和热门城市就是通过添加这个头部(BannerHeaderAdapter
的item布局):
<LinearLayout xmlns:android=“http://schemas.android.com/apk/res/android”
android:orientation=“vertical”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”>
<TextView
android:layout_width=“match_parent”
android:layout_height=“40dp”
android:text=“定位城市”
android:gravity=“center_vertical”
android:paddingLeft=“15dp”
android:textSize=“@dimen/text_size_18”
android:textColor=“@color/black”
/>
<TextView
android:id=“@+id/item_header_city_dw”
android:layout_width=“80dp”
android:layout_height=“35dp”
android:textColor=“@color/black”
android:gravity=“center”
android:layout_marginLeft=“15dp”
android:background=“@drawable/sylayout_shop”
android:text=“东莞”/>
<View
android:layout_width=“match_parent”
android:layout_height=“1dp”
android:background=“@color/gray2”
android:layout_margin=“15dp”
/>
<LinearLayout
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:layout_weight=“1”
android:paddingBottom=“5dp”
android:paddingLeft=“15dp”
android:paddingRight=“30dp”
android:orientation=“vertical”>
<TextView
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:textSize=“18sp”
android:textColor=“@color/black”
android:text=“热门城市”/>
<com.wzg.biswang.util.QGridView
android:id=“@+id/item_header_city_gridview”
android:layout_marginTop=“5dp”
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:focusable=“true”
android:focusableInTouchMode=“true”
android:numColumns=“3”
android:stretchMode=“columnWidth”
android:columnWidth=“60dp”
android:verticalSpacing=“10dp”
android:horizontalSpacing=“15dp”>
</com.wzg.biswang.util.QGridView>
<View
android:layout_width=“match_parent”
android:layout_height=“1dp”
android:background=“@color/gray2”
android:layout_marginLeft=“15dp”
android:layout_marginRight=“15dp”
android:layout_marginTop=“10dp”
/>
<TextView
android:layout_width=“match_parent”
android:layout_height=“50dp”
android:textSize=“18sp”
android:textColor=“@color/black”
android:layout_marginLeft=“15dp”
android:gravity=“center_vertical”
android:text=“所有城市”/>
ContactAdapter
的适配器也就是IndexableLayout的Adapter
,这里必须继承IndexableAdapter<UserEntity>
,你也可以直接把这段代码复制下来 :
public class ContactAdapter extends IndexableAdapter {
private LayoutInflater mInflater;
public ContactAdapter(Context context) {
mInflater = LayoutInflater.from(context);
}
//设置悬浮块的layout
@Override
public RecyclerView.ViewHolder onCreateTitleViewHolder(ViewGroup parent) {
View view = mInflater.inflate(R.layout.item_index_contact, parent, false);
return new IndexVH(view);
}
最后
其实Android开发的知识点就那么多,面试问来问去还是那么点东西。所以面试没有其他的诀窍,只看你对这些知识点准备的充分程度。so,出去面试时先看看自己复习到了哪个阶段就好。
下面分享的腾讯、头条、阿里、美团、字节跳动等公司2019-2021年的高频面试题全套解析,博主还把这些技术点整理成了视频和PDF(实际上比预期多花了不少精力),包含知识脉络 + 诸多细节,由于篇幅有限,下面只是以图片的形式给大家展示一部分。
知识不体系?这里还有整理出来的Android进阶学习的思维脑图,给大家参考一个方向。
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
view = mInflater.inflate(R.layout.item_index_contact, parent, false);
return new IndexVH(view);
}
最后
其实Android开发的知识点就那么多,面试问来问去还是那么点东西。所以面试没有其他的诀窍,只看你对这些知识点准备的充分程度。so,出去面试时先看看自己复习到了哪个阶段就好。
下面分享的腾讯、头条、阿里、美团、字节跳动等公司2019-2021年的高频面试题全套解析,博主还把这些技术点整理成了视频和PDF(实际上比预期多花了不少精力),包含知识脉络 + 诸多细节,由于篇幅有限,下面只是以图片的形式给大家展示一部分。
[外链图片转存中…(img-7EAHQUjb-1715850424540)]
知识不体系?这里还有整理出来的Android进阶学习的思维脑图,给大家参考一个方向。
[外链图片转存中…(img-w1naxqaN-1715850424541)]
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!