我有一个适配器。我在一个片段中列出数据。在清单中; 4个按钮,个人资料照片和文本视图。我可以只用collection.shuffle();拖曳按钮吗?
public class PostAdapter extends RecyclerView.Adapter<PostAdapter.ViewHolder> {
public Context mContext;
public List<Posts> mPosts;
private FirebaseUser firebaseUser;
public PostAdapter(Context mContext, List<Posts> mPosts) {
this.mContext = mContext;
this.mPosts = mPosts;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View view = LayoutInflater.from(mContext).inflate(R.layout.all_posts_layout, viewGroup, false );
return new PostAdapter.ViewHolder(view);
}
}