几个 Android 软键盘问题
这是一种转发,我对任何违反规则的行为表示歉意,但我对 Android 手机上的软键盘有几个问题:
1)我有一个 Android 应用程序,有几个不同的视图(用户在它们之间切换)。我如何确定哪个是当前视图?我需要获取当前视图来执行隐藏虚拟键盘的代码。
2)如何检查当前是否正在显示虚拟键盘(以便我可以过滤各种硬键的操作)?
谢谢, R。
This is kind of a repost, and I apologize for any broken rules, but I have a couple of questions about the soft keyboard on Android phones:
1) I have an Android app with a couple different views (that the user switches between). How can I determine which is the current view?? I need to get the current view to execute the code that hides the virtual keyboard.
2) How can I check whether the virtual keyboard is currently being displayed (so I can filter the actions of my various hard keys)??
Thanks,
R.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
1)
public class ViewIdentification extends Activity Implements OnFocusChangeListener{
}
注意:通过这种方式我们可以知道哪个视图获得焦点。
2)
这可以通过计算活动的大小(最后聚焦视图所在的位置)来完成。
1)
public class ViewIdentification extends Activity implements OnFocusChangeListener{
}
NOTE : In this way we can get to know which view is focused .
2)
This can be done by calculating the size of the activity ( the location at which the last focused view is at ) .