如何将旋转器位置设置为从不同片段选择的选择中选定的项目
这是我第一次问一个问题,我是一个新的编码器,并且一直在与Kotlin和Java一起尝试Android。我有一个应用程序,允许用户添加一件衣服,这些选项是使用旋转器设置的。问题是当用户从旋转器中选择一个项目时,我想更新值(如图像)显示蓝色单词,说棕色是选项的选项,添加服装项目旋转器,但旋转器显示灰色显示灰色我可以将旋转器设置为棕色而不是默认值。
this is my first time asking a question and I am a new coder and been trying out android with kotlin and java. I have an app that allows a user to add an item of clothing the options are set up with spinners. The issue is when the user selects an item from the spinner it saves and when I want to update the values like the image shows the blue words saying brown is the option selected form the add clothing item spinner but the spinner is showing grey is there a way I can set the spinner to be on brown and not the default value.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的。您需要使用getItematPosition()方法。从您的用户界面中,您要检索的对象是字符串。因此,如果您在Java中编写代码。知道您已经使用了文本视图来显示选择
java
kotlin
您可以从这里将代码转换为Kotlin。阅读此。
如何转换Java的一部分源文件到Kotlin?
Yes. You need to use the getItemAtPosition() method. From your user interface, the Object you are trying to retrieve is a String. So if you wrote your code in Java. Knowing you've used a TextView to display the selection
Java
KOTLIN
You can convert the code to Kotlin from here. Read this.
How can I convert a part of Java source file to Kotlin?