Skip to content

A simple, customizable and easy to use picker where centre view is scaled up

License

Notifications You must be signed in to change notification settings

naseemakhtar994/HorizontalPicker-2

 
 

Repository files navigation

HorizontalPicker

A simple, customizable and easy to use picker where centre view is scaled up

License Apache

Demo screen 1

QuickStart

Include the Gradle dependency

dependencies {
    compile 'com.github.adityagohad:HorizontalPicker:1.0.0'
}

How to use

Your picker will be recyclerView and this lib is just a custom layout manager to initialize the PickerLayoutManager and set the properties

PickerLayoutManager pickerLayoutManager = new PickerLayoutManager(this, PickerLayoutManager.HORIZONTAL, false);
pickerLayoutManager.setChangeAlpha(true);
pickerLayoutManager.setScaleDownBy(0.99f);
pickerLayoutManager.setScaleDownDistance(0.8f);

To make it snap to centre use SnapHelper

SnapHelper snapHelper = new LinearSnapHelper();
snapHelper.attachToRecyclerView(recyclerView);

set layout manager of your recyclerVew

recyclerView.setLayoutManager(pickerLayoutManager);

To get selected view use onScrollStopListener

pickerLayoutManager.setOnScrollStopListener(new PickerLayoutManager.onScrollStopListener() {
    @Override
        public void selectedView(View view) {
            //Do your thing
        }
    });
}

About

A simple, customizable and easy to use picker where centre view is scaled up

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%