如何让活动的windowToken没有看法? [英] how to get Activity's windowToken without view?

查看:75
本文介绍了如何让活动的windowToken没有看法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在,我试图隐藏softkeyboard当键盘外部用户触摸:

Now, I try to hide the softkeyboard when user touch outside the keyboard:

((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE))
.hideSoftInputFromWindow(editView.getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);

我希望把逻辑在我的基地活动课,所以如果有可能没有查看到getWindowToken?

I want put the logic in my base activity class, so if it is possible to getWindowToken without View?

推荐答案

当然,你可以使用:

getContentView().getWindowToken()

也可以参考<一个href="http://stackoverflow.com/questions/2785558/find-the-window-containing-a-view-in-android/2816319#2816319">SO探索

这篇关于如何让活动的windowToken没有看法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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