The recent customizations show different item type Recyclerview, and the selected item is labeled with the status checked, so rewrite recyclerview.adapter to implement;
In the process, there are some problems that need to be noted here:
1, by overriding the Getitemviewtype method class setting item displays different types of holdview; in Oncreateviewholder method, different holdview are displayed according to different types ;
2. When overriding the Oncreateviewholder method, the definition of the attached event, and if the exception is defined in the overriding Onbindviewholder method, it will affect the efficiency of each refresh;
3, when the status of the selected item is updated, if you only mark the status of the currently selected item at a time, you can use the variable to record the current Nowselectindex, and then, through the list of managed LayoutManager to determine
Whether the previous selected item is within the currently displayed item range, and if so, refreshes the list with notifyitemchanged (Nowselectindex) or other notify methods and updates the Nowselectindex
The value of this method implements updating the code for the selected item state is placed in the implementation of the Onbindviewholder method.
Above is a personal opinion, hope Big S pass by when pointing <.>
Recyclerview.adapter, watch out.