Customizable android component for picking an integer.
Make sure jcenter is in your project build settings and then simply add the following to the dependencies section of your app:
implementation 'com.github.sohe1l.arrownumberpicker:arrownumberpicker:0.1.2'
This project requires API level 16.
Baisc Usage in layout:
<com.github.sohe1l.arrownumberpicker.ArrowNumberPicker
android:id="@+id/number_picker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
To get the selected value:
ArrowNumberPicker arrowNumberPicker = findViewById(R.id.number_picker);
int count = numPicker.getValue();
To set the picker value dyanmically:
ArrowNumberPicker arrowNumberPicker = findViewById(R.id.number_picker);
numPicker.setValue(24);
To set a callback listener for change event:
// on your activity
// implement ArrowNumberPicker.PickerChangeListener
@Override
public void onPickerChanged(int newValue) {
// use newValue or numPicker.getValue()
}
Customizable options:
<com.github.sohe1l.arrownumberpicker.ArrowNumberPicker
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:id="@+id/number_picker_custom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
custom:button_background_color="#575757"
custom:button_border_color="#575757"
custom:button_border_width="1dp"
custom:button_padding="8dp"
custom:button_text_color="#FFFFFF"
custom:button_text_size="14sp"
custom:button_width="100dp"
custom:picker_background_color="#000000"
custom:picker_text_color="#FAFAFA"
custom:picker_text_size="16sp" />
Please open an issue for support.
Please contribute using Github Flow. Create a branch, add commits, and open a pull request.