Callback method to be invoked when an item in this view has been selected. This callback is invoked only when + * the newly selected position is different from the previously selected position or if there was no selected + * item.
+ * + * @param view The {@link MaterialSpinner} view + * @param position The position of the view in the adapter + * @param id The row id of the item that is selected + * @param item The selected item + */ + void onItemSelected(MaterialSpinner view, int position, long id, T item); + } + + /** + * Interface definition for a callback to be invoked when the dropdown is dismissed and no item was selected. + */ + public interface OnNothingSelectedListener { + + /** + * Callback method to be invoked when the {@link PopupWindow} is dismissed and no item was selected. + * + * @param spinner the {@link MaterialSpinner} + */ + void onNothingSelected(MaterialSpinner spinner); + } + + /** + * 无更多选择的监听 + */ + public interface OnNoMoreChoiceListener { + /** + * 无更多选择 + * + * @param spinner + */ + void OnNoMoreChoice(MaterialSpinner spinner); + } + +} diff --git a/app/src/main/java/com/project/survey/widget/materialspinner/MaterialSpinnerAdapter.java b/app/src/main/java/com/project/survey/widget/materialspinner/MaterialSpinnerAdapter.java new file mode 100644 index 0000000..7ded4ab --- /dev/null +++ b/app/src/main/java/com/project/survey/widget/materialspinner/MaterialSpinnerAdapter.java @@ -0,0 +1,56 @@ +package com.project.survey.widget.materialspinner; + +import android.content.Context; + +import java.util.List; + +/** + * Spinner适配器 + * + * @author xuexiang + * @since 2019/1/14 下午10:08 + */ +public class MaterialSpinnerAdapter