如何更改了Android TimePicker分钟间隔?间隔、如何更改、Android、TimePicker

由网友(如果当初我够勇敢)分享简介:我写这封信,用户需要指定在某一时间点的应用程序,但我似乎无法弄清楚如何设置分钟值,用户可以从中选择,以5只使用增量,而不是增量为1。I am writing an application where the user needs to specify a given point in time, but i can'...

我写这封信,用户需要指定在某一时间点的应用程序,但我似乎无法弄清楚如何设置分钟值,用户可以从中选择,以5只使用增量,而不是增量为1。

I am writing an application where the user needs to specify a given point in time, but i can't seem to figure out how to set the minute values that the user can choose from, to only use increments of 5 instead of increments of 1.

简单地说,当通过提供大量的用户滚动,他/她必须只看到0,5,10,15等。

Simply put, when the user scrolls through the available amounts, he/she must only see 0,5,10,15 etc.

感谢你在前进。

推荐答案

所有相关答案需要你设置一个OnTimeChangedListener。 我的分辨率是您扩展了Android的TimePicker,并修改它的构造器:

all relative answer need you to set an OnTimeChangedListener. My resolution is that you extends android TimePicker,and modify the constructor of it:

    // minute
    mMinuteSpinner = (NumberPicker) findViewById(R.id.minute);
    mMinuteSpinner.setMinValue(0);
    mMinuteSpinner.setMaxValue(3);
    mMinuteSpinner.setDisplayedValues(new String[]{"0", "15", "30", "45"});
    mMinuteSpinner.setOnLongPressUpdateInterval(100);
    mMinuteSpinner.setFormatter(NumberPicker.getTwoDigitFormatter());

这样你就可以得到你想要的间隔时间。

so you can have the interval you want.

阅读全文

相关推荐

最新文章