Android DatePicker帮助,知道哪个EditText调用了

发布于 2024-11-26 08:20:42 字数 344 浏览 1 评论 0原文

我正在关注本教程: http://developer.android.com /resources/tutorials/views/hello-datepicker.html

我有两个 EditText,其中一个调用 showDialog(0),即 DatePickerDialog。我如何知道哪个 EditText 调用了 showDialog?因为 updateDisplay (教程中的方法)没有显示如何执行此操作!

I'm following this tutorial: http://developer.android.com/resources/tutorials/views/hello-datepicker.html .

I have two EditText, and which one calls showDialog(0) that is the DatePickerDialog. How can I know which EditText called the showDialog? Because the updateDisplay (method in tutorial) doesn't show how to do this!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

何其悲哀 2024-12-03 08:20:42

在你的OnClick方法中,你可以得到哪个视图被点击

view.getId()

然后,将它与你的editTexts的id(你在xml文件上设置的id)进行比较,你就会知道调用了哪个视图

On your OnClick method, you can get which view was clicked

view.getId()

Then, compare it to the id of your editTexts (the ids that you set on the xml file) and you will know which one was called

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文