【发布时间】:2016-06-27 22:03:33
【问题描述】:
【问题讨论】:
标签: android datepicker calendar spinner
【问题讨论】:
标签: android datepicker calendar spinner
只需将 pickerMode 添加到 XML 文件中的 DatePicker 即可:
<DatePicker
...
android:datePickerMode="spinner" />
【讨论】:
或者您可以添加一个更可定制的弹出对话框。如果您使用弹出对话框,那么与微调器相比,您必须处理更多案例。
并且在视图的onclick事件中,附加popupwindow
PopupWindow yourDatePopup = datePopupWindow();
//this line will give a spinner effect
yourDatePopup.showAsDropDown(clickableView, -7, 0);
public PopupWindow datePopupWindow() {
PopupWindow popupWindow = new PopupWindow(this);
popupWindow.setFocusable(true);
popupWindow.setWidth(WindowManager.LayoutParams.WRAP_CONTENT);
popupWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
// set the list view as pop up window content
//Define your dateview
popupWindow.setContentView(yourDateView);
popupWindow.setOutsideTouchable(true);
return popupWindow;
}
注意:- 只是为了帮助,而不是确切的代码
【讨论】: