Android RecyclerView添加和删除项目
我有一个带有TextView文本框和十字按钮ImageView的RecyclerView。我在recyclerview外面有一个按钮,使十字按钮ImageView可见/不见了。 我想从recylerview中删除一个项目,当该项目十字按钮ImageView被按下时。 我的适配器: public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder> implements View.OnClickListener, View.OnLongClickListener { private ArrayList<String> mDataset; private static Context sContext; public MyAdapter(Context context, ArrayList<String> myDataset) { mDataset = myDataset; sContext = context; } @Override public MyAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,int viewType) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.my_text_view, parent, false); ViewHolder holder = new ViewHolder(v); …