我想只通过此持有者一次绑定视图持有者在recyclerview中有一个
示例代码
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (viewType == FEED_ITEM) {
return new FeedViewHolder(new StoryListItem(context));
} else if (viewType == SUGGEST_FRIEND_ITEM) {
return new SuggestFriendViewHolder(new FeedSuggestFriendListItem(context));
} else {
return new EmptyViewHolder(new EmptyViewListItem(context));
}
}
@Override
public int getItemViewType(int position) {
if(position==0){
return SUGGEST_FRIEND_ITEM;
}else{
return FEED_ITEMว
}
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (holder instanceof FeedViewHolder) {
((FeedViewHolder) holder).fillData(newFeeds.get(position).getData());
} else if (holder instanceof SuggestFriendViewHolder) {
((SuggestFriendViewHolder) holder).fillData();
}
我只想一次bindViewHolder suggestFriendViewHolder
我的问题是当从其他位置滚动到第一个位置(position = 0)并且每次滚动到position = 0时suggestFriendViewHolder绑定数据。我想一次绑定数据suggestFriendViewHolder。