我在Android L模拟器上测试我的应用程序,我注意到TimePickerDialog已经显着改变了:

这不符合我的应用程序的主题,我想知道在Android L上运行时是否可以获得旧的TimePickerDialog样式.
我看了一下这个答案,但是使用了API timepickerdialog(下面的代码)我想在我的类中设置timePickerMode属性.java有可能吗?
public static class TimePickerFragment extends DialogFragment
implements TimePickerDialog.OnTimeSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the current time as the default values for the picker
final Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
// Create a new instance of TimePickerDialog and return it
return new TimePickerDialog(getActivity(), this, hour, minute,
DateFormat.is24HourFormat(getActivity()));
}
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
// Do something with the time chosen by the …Run Code Online (Sandbox Code Playgroud) 我试图了解如何正确地将选项从react-native的js端传递到java端.
react-native桥使用ReadableMap进行转换,但作为Java noob,我无法理解其工作原理.
更具体地说,我不明白:
一般来说,我想知道这是如何工作的,但我会给出一个具体的例子,我正在考虑给出一些背景信息.
react-native软件包公开了一个日期时间选择器.
JS方面有一个showTimePicker方法:
showTimePicker(date, callback) {
date = date || new Date();
console.log(this.props);
debugger
var options = {
...this.props,
hour:date.getHours(),
minute:date.getMinutes()
};
RCTDateTimePicker.showTimePicker(options, function (hour, minute) {
date.setHours(hour);
date.setMinutes(minute);
callback(date);
});
}
Run Code Online (Sandbox Code Playgroud)
RCTDateTimePicker.showTimePicker在本机端桥接到Java 方法:
@ReactMethod
public void showTimePicker(ReadableMap options, Callback callback) {
DialogFragment timePicker = new TimePicker(options, callback);
timePicker.show(activity.getFragmentManager(), "timePicker");
}
Run Code Online (Sandbox Code Playgroud)
哪个叫
public TimePicker(ReadableMap options, Callback callback) {
final Calendar c = Calendar.getInstance();
this.callback = callback;
hour = options.hasKey("hour") …Run Code Online (Sandbox Code Playgroud)