RobertApikyan / SegmentedControl

Android SegmentedControl + multi row support
Apache License 2.0
162 stars 30 forks source link

how to disable select?? #30

Open alibadparva opened 4 years ago

alibadparva commented 4 years ago

how to disable select and click??

RobertApikyan commented 4 years ago

You can disable the select event, for that use setOnSegmentSelectRequestListener method, and return false if you do not want to perform the select event

segmentedControl.setOnSegmentSelectRequestListener { segmentViewHolder -> false }
public interface OnSegmentSelectRequestListener<D> {
    /**
     * The event will be triggered before perform segment selection,and after segment click event
     *
     * @param segmentViewHolder, clicked segment view holder
     * @return false segment selection will be ignored, true segment selection will be performed
     */
    boolean onSegmentSelectRequest(SegmentViewHolder<D> segmentViewHolder);
}