Search code examples
androidnumberpicker

How to reduce the thickness of line in number picker


I have tried to reduce the thickness of horizontal line in Number Picker but its not working.So i want to know how to reduce the thickness of line in Number Picker


Solution

  • Have a try as follow:

    private void setNumberPickerDivider(NumberPicker picker) {
            Field[] fields=NumberPicker.class.getDeclaredFields();
            for(Field f:fields){
                if(f.getName().equals("mSelectionDividerHeight")){
                    f.setAccessible(true);
                    try {
                    f.set(picker,1);
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
                break;
                }
            }
        }