微调没有得到焦点 [英] Spinner did not got focus

查看:145
本文介绍了微调没有得到焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的我的android创建中,我用4的EditText字段和2纱厂在一个活动的应用程序。这些成分的顺序是2的EditText然后2纺纱,然后2的EditText字段。那我有问题是当我从EditText上转移焦点(用软键盘下一个按钮的帮助)spiner,微调没有得到关注的焦点和重点是tranferd到放置在纺纱后的EditText领域。我已经使用requestFocus的()上微调,但没有奏效。

I am new to android I have created an application in which i use 4 edittext fields and 2 spinners in an activity. the order of these components are 2 edittext then 2 spinners and then 2 edittext fields. Problem that i have got is when i transfer focus (with the help of soft keyboard next button) from edittext to spiner, spinner did not get the focus and the focus is tranferd to edittext field that was placed after the spinners. I have used requestfocus() on spinner but it did not work.

时有什么办法,微调了关注的焦点?

Is there any way that spinner got the focus?

问候, 沙面

推荐答案

谢谢,我已经通过执行以下操作解决:

Thanks, I have solved by doing the following:

  1. 在我设置在顶部的微调对象(的onCreate 方法中),只是为了确保我的code最先被执行
  2. 我用下面的:

  1. I set the Spinner object on top (within the onCreate method) just to make sure that my code gets executed first
  2. I used the following:

Spinner s1 = (Spinner) findViewById(R.id.spinner1); 
s1.setFocusable(true); 
s1.setFocusableInTouchMode(true);
s1.requestFocus();

这篇关于微调没有得到焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆