How to select multiple item in ListView in android.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
You cannot "select" multiple items in a
ListView
. You can useCHOICE_MODE_MULTIPLE
and check multiple items in aListView
.Best way is to have a contextual action bar with listview on multiselect, You can make listview as multiselect using the following code
And now set multichoice listener for Listview ,You can see the complete implementation of multiselect listview at Android multi select listview
Step 1: setAdapter to your listview.
Step 2: set choice mode for listview .The second line of below code represents which checkbox should be checked.
Step 3: Checked views are returned in SparseBooleanArray, so you might use the below code to get key or values.The below sample are simply displayed selected names in a single String.
I would advice to check the logic of
ListActivity
according to what is needed could be the best way not to lose much timelink
developer.android
and to get it :
It's very simple,