0

I want to have number picker with values 10,20,30,40,50 when I'm doing like this:

    minutePicker.setMaxValue(10);
    minutePicker.setMinValue(1);
    minutePicker.setDisplayedValues(values);

provided values is {"30", "40", "50", "60", "70"};

Im able to display values as expected but these are like edit text, when I'm taping on each value keyboard displays, how can I make it just display value as textview rather edit text

blackHawk
  • 6,047
  • 13
  • 57
  • 100

1 Answers1

0

Create NumberPicker class like below

public class MyNumberPicker extends NumberPicker {

public MyNumberPicker(Context context, AttributeSet attrs) {
    super(context, attrs);
    processAttributeSet(attrs);
}

public MyNumberPicker(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    processAttributeSet(attrs);
}
private void processAttributeSet(AttributeSet attrs) {
    //This method reads the parameters given in the xml file and sets the properties according to it
    this.setMinValue(attrs.getAttributeIntValue(null, "min", 0));
    this.setMaxValue(attrs.getAttributeIntValue(null, "max", 0));
}

}

Fakhriddin Abdullaev
  • 4,169
  • 2
  • 35
  • 37