How to Hide or Disable Minutes widget in Android TimePickerDialog?
I'm working on an application where i want to give user the ability of just to select Hours and AM/PM but Minutes widget should be fixed 开发者_运维知识库as i mentioned. I am using TimePickerDialog. Is there any possibility of doing that?
I am not sure but you can use Android wheel with Timepicker.
http://code.google.com/p/android-wheel/source/browse/trunk/wheel/src/kankan/wheel/demo/TimeActivity.java?r=16
and also check out this link:
http://code.google.com/p/android-wheel/
There's no direct way. TimePickerDialog doesn't even give you TimePicker that it's using. So you'd have to copy code from TimePickerDialog.java to suit your own needs.
Another part is that TimePicker doesn't give you access to its sub-views (id's are not public), so you'd also need to copy time_picker.xml from Android sources, and create your own TimePicker view.
Good news is that you can copy from Android source code, and both mentioned sources are rather short, so it's relatively easy task to make this work.
精彩评论