Max selectable count for “CHOICE_MODE_MULTIPLE_MODAL” gridview

前端 未结 3 2017
终归单人心
终归单人心 2021-01-27 16:55

I created a Gridview with CHOICE_MODE_MULTIPLE_MODAL in Android.

Everything\'s working well. But as per requirements, I have to set a limit for selecta

3条回答
  •  轮回少年
    2021-01-27 17:29

    Use getCheckedItemCount() method to check the count on gridview's item select listener and check if count greater than max value

    public int getCheckedItemCount ()

    Returns the number of items currently selected. This will only be valid if the choice mode is not CHOICE_MODE_NONE (default).

提交回复
热议问题