程序在setLayoutManager的时候crash,debug之后发现初始化recyclerview的时候findViewById失败了,最后发现是因为inflate方法里的layout名字写错了。。。
View view = inflater.inflate(R.layout.news_title_frag, container,false); 找到对应layout,然后RecyclerView newsTitleRecyclerView = (RecyclerView) view.findViewById(R.id.news_title_recycler_view); layout写错导致没找到id。