我应该如何动态更改微调器的条目?
这个问题的措辞不够好,无法得到我想要的答复,所以我发布了一个新的、几乎完全不同的问题。
This question was not worded well enough to get the responses I wanted, so I am posting a new, almost completely different question.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您在 UI 中看到的并不是对象本身,您可以创建一个新实例,填充它,然后将其链接到视图。还可以考虑为您的应用程序使用连续的列表视图,它更干净、更容易维护并且更用户友好。
What you see in the UI is not the object itself, from that, you can make a new instance, populate it and then link it to the view. Also consider using consecutive listviews for your application, it's cleaner, easier to mantain and more user friendly.
您要做的是,从第二个和第三个微调器启用状态开始为 false,因为它们的值尚不清楚,当为您启用的第一个微调器触发 ItemSelected 时,清除并根据当前选择为第二个微调器创建一个新适配器,启用第二个微调器)对第三个微调器重复相同的步骤,这里您需要注意的是,如果在第一个微调器上选择了新项目,则必须禁用第三个微调器,因为现在它的值再次未知。
What you gotta do is, start with 2nd and 3rd spinner enabled state to false as their values are yet unknown, when the ItemSelected is fired for the first spinner you enable, clear and create a new adapter for the second based on the current selection and enable the second spinner ) repeat the same step for the third spinner, the here you gotta pay attention here to is, you gotta disable the third spinner if a new item is selected on the first spinner as now it's value is again unknown.
我终于有了答案。访问另一个微调器的
onSelectedItemChanged
中的微调器和适配器的唯一方法是使它们成为最终的。因此,我必须制作 20 个“final
”适配器和用例来设置每个适配器。I finally have an answer. The only way to access the spinners and adapters in another spinner's
onSelectedItemChanged
is to make them final. So I had to make 20 "final
" adapters and use cases to set each one.