项目作者: puskal-khadka

项目描述 :
Android Library for Multi Select Checkbox spinner functionality
高级语言: Kotlin
项目地址: git://github.com/puskal-khadka/MultiSelectSpinner.git
创建时间: 2021-09-03T05:41:18Z
项目社区:https://github.com/puskal-khadka/MultiSelectSpinner

开源协议:

下载


MultiSelectSpinner

Android Library for Dropdown MultiSelect Spinner functionality

Installation - Gradle

  1. dependencies {
  2. ...
  3. implementation 'com.github.puskal-khadka:MultiSelectSpinner:1.0.1'
  4. }

Usage

  1. <com.puskal.multiselectspinner.MultiSelectSpinnerView
  2. android:id="@+id/multiSelectSpinner"
  3. android:layout_width="wrap_content"
  4. android:layout_height="wrap_content"
  5. android:layout_marginEnd="8dp"
  6. ></com.puskal.multiselectspinner.MultiSelectSpinnerView>

Setting Up

  • Make a list of string which you want to show in drodown. If you have list of object then you can map it into string list
  • Use buildCheckedSpinner method of library and send string list as parameter with listener
  • onChecking Checkbox it will return position of selected item. Here in dropdown you will get two addition field “All” and “OK”,
    Returned Position is on the basis of your original list. “All” or “OK” will not consider as a part of list
    1. val testDataList = arrayListOf("Kotlin", "Java", "Python", "Php", "Swift")
    2. with(binding) {
    3. multiSelectSpinner.buildCheckedSpinner(testDataList){ selectedPositionList, displayString ->
    4. tvSelectedPosition.text = "Selected position: $selectedPositionList" //if kotlin, python selecteed:returned postion will be 0,2
    5. tvDispString.text = "Display String: $displayString"
    6. }
    7. }

Contribution

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.