Android RecyclerView更新子项目notifyItemChanged
Android RecyclerView更新子项目notifyItemChanged 在过去Android的ListView中,如果ListView中某一个或者一批项目发生变化,需要通过adapter的notifyDataSetChanged更新数据到最新,但是从ListView演进到现在的RecyclerView,数据的更新不需要像ListView那样notifyDataSetChanged,而是要采用RecyclerView的notifyItemChanged,传入一个pos位置,通知RecyclerView该pos位置已经失效,需要重新绘制和UI更新。现在给出一个例子,上面一个Button按钮,下面一个RecyclerView: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical...
