ListView长按弹出CheckBox,实现全选,反选,批量删除功能.
主布局:activity_main
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/main_activity" tools:context="com.pinpaimap.listviewcheckbox.MainActivity"> <ListView android:id="@+id/main_listview" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/lay"/> <LinearLayout android:id="@+id/lay" android:visibility="gone" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#00f0f0" android:layout_alignParentBottom="true" android:weightSum="4" android:orientation="horizontal"> <TextView android:id="@+id/operate_back" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:text="返回" android:textSize="22sp" android:background="@drawable/selector" android:paddingTop="5dp" android:paddingBottom="5dp"/> <TextView android:id="@+id/operate_select" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:text="全选" android:textSize="22sp" android:background="@dra