RecyclerView中的CheckBox继续检查其他项目
这是RecyclerView中我商品的XML <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/cvItems" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_margin="2dp" card_view:cardElevation="0dp" card_view:contentPadding="0dp" card_view:cardBackgroundColor="#FFFFFF" > <LinearLayout android:orientation="horizontal" android:layout_height="fill_parent" android:layout_width="fill_parent"> <TextView android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="0.8" android:id="@+id/tvContent" android:textSize="15dp" android:paddingLeft="5dp" android:paddingRight="5dp" /> <CheckBox android:id="@+id/cbSelect" android:layout_width="0dip" android:layout_weight="0.2" android:layout_height="match_parent" android:button="@drawable/cb_checked" android:gravity="center_horizontal" android:textAlignment="center" android:layout_gravity="center_horizontal" /> </LinearLayout> </android.support.v7.widget.CardView> 这是RecyclerView适配器,可以为其每个项目增加上面的布局: public class AdapterTrashIncome extends RecyclerView.Adapter<AdapterTrashIncome.ViewHolder> { private ArrayList<ObjectIncome> myItems = new ArrayList<>(); …