How to change the recyclerview first row layout?
问题 I want to add different layout for the first row, how can i set it up? Adapter class: This is the normal, all row equals: @Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { inflater=LayoutInflater.from(parent.getContext()); return new MyViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_trends, parent, false)); } And what to change in the OnBindViewHolder method? 回答1: First you need to override getItemViewType . Return itemType according