将焦点添加到微调器
这里我有一个微调器和微调器下方的一些文本字段。当其中一个文本字段具有焦点时,我从微调器中选择一个项目,我看到焦点仍然在该文本字段上,现在我想做的是,在选定的微调器项目上,我想将焦点从该文本字段更改为微调器。 有什么方法可以将焦点设置为旋转器吗?比如,
@Override
public void onItemSelected(AdapterView<?> parent, View view,
int position, long id) {
//set focus to the spinner
}
}
Here i have a spinner and some text fields below the spinner. when one of the text field has focus, i select an item from spinner and i see the focus is still on that text field, Now what i want to do is, on spinner item selected i want to change focus from that text field to the spinner.
Is there any way to set focus to spinner?like,
@Override
public void onItemSelected(AdapterView<?> parent, View view,
int position, long id) {
//set focus to the spinner
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了类似的问题,并在此处找到了部分答案。
但是,我还必须从代码而不是 XML 文件中设置 focusable(true) 和 focusableInTouchMode(true)。在我在代码中设置可聚焦属性之前,我无法让它工作。这是我的项目的示例:
I had a similar problem and found part of the answer here.
However, I also had to set focusable(true) and focusableInTouchMode(true) from my code and not the XML file. I couldn't get it to work until I set the focusable properties in the code. Here is a sample from my project:
在我的案例中工作
worked in my case doing