文章标题
创建定制列表项布局
把列表项视图剥离为独立的布局文件
更新adapter,使用定制列表项布局
private class CrimeAdapter extends RecyclerView.Adapter<CrimeHolder> {
……
@Override
public CrimeHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//创建View视图
LayoutInflater layoutInflater = LayoutInflater.from(getActivity());
//把View视图封装到ViewHolder
// View view = layoutInflater.inflate(android.R.layout.simple_list_item_1, parent, false);
View view = layoutInflater.inflate(R.layout.list_item_crime,parent,false);
return new CrimeHolder(view);
}