使用espresso测试软键盘是否可见 [英] Test if soft keyboard is visible using espresso
本文介绍了使用espresso测试软键盘是否可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在活动调用onCreate()和onResume()时测试键盘的可见性.
I want to test keyboard visibility when an activity calls onCreate() and onResume().
如何测试是否使用espresso显示键盘?
How can i test whether or not the keyboard is shown using espresso?
推荐答案
fun isKeyboardShown(): Boolean {
val inputMethodManager = InstrumentationRegistry.getInstrumentation().targetContext.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
return inputMethodManager.isAcceptingText
}
位于 Google网上论坛
这篇关于使用espresso测试软键盘是否可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文