如何从偏好活动中调用时间选择器?
您能告诉我如何从偏好活动中调用时间选择器吗?
您能否在首选项活动中显示所需的 manifest.xml、layout.xml 和代码以及调用时间选择器所需的任何其他文件?
Can you tell me how to call a time picker from a preference activity?
Can you show the needed manifest.xml, layout.xml and code inside the preference activity and any other needed files to call the time picker?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要将 TimePicker 添加到标准 Activity,请将 TimePicker 小部件添加到您的布局,如下所示:
接下来,让您的 Activity 实现 OnTimeChangedListener。然后,您需要将以下方法添加到您的活动中:
要从 PreferenceActivity 调用 TimePicker,您可能需要考虑弹出一个对话框来处理用户的时间选择。看一下这个类,它显示了这样做的实现:
http ://code.google.com/p/onlinemanager/source/browse/trunk/WebViewer/src/fr/webviewer/activity/PreferenceActivity.java?r=76
To add a TimePicker to a standar Activity, add the TimePicker widget to your layout like this:
Next, have your activity implement OnTimeChangedListener. Then you'll need to add the following method to your activity:
To call a TimePicker from a PreferenceActivity, you may want to consider popping up a dialog to handle the selection of time from the user. Have a look at this class which shows an implementation of doing so:
http://code.google.com/p/onlinemanager/source/browse/trunk/WebViewer/src/fr/webviewer/activity/PreferenceActivity.java?r=76