• 1000
Как изменить данные полезной нагрузки на TYPE_ITEM viewType?
> **CustomViewAdapter class**
private static final int TYPE_HEADER = 0;
private static final int TYPE_ITEM = 1;
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (viewType == TYPE_ITEM) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.home_list_items, parent, false);
return new MyViewHolder(itemView);
} else if (viewType == TYPE_HEADER) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.home_banner, parent, false);
return new HeaderView(itemView);
}
return null;
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position, @NonNull List<Object> payloads) {
Log.d(TAG, "onBindViewHolder: viewholder " + viewHolder);
Log.d(TAG, "onBindViewHolder: payload " + payloads);
}