android - Espresso : how to scroll to the bottom of ScrollView

标签 android android-espresso

如何在 Espresso 测试中向下滚动到 ScrollView 的底部? 谢谢!

最佳答案

如果您需要在 ScrollView 的底部找到一个 View 并与之匹配,那么只需对其执行 scrollTo() 操作,然后再执行任何其他需要显示它的操作.

onView(withId(R.id.onBottomOfScrollView))
    .perform(scrollTo(), click());

Note: scrollTo will have no effect if the view is already displayed so you can safely use it in cases when the view is displayed

关于android - Espresso : how to scroll to the bottom of ScrollView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30387255/

相关文章:

Android Espresso - 单击带有图像和文本的抽屉导航项目

java - Android 测试是否显示 toast

java - 在 eclipse 中创建应用程序 : Error parsing XML: not well-formed (invalid token)

java - Android创建和使用全局变量的简单方法?

android - 如何更改android sharedPreferences 保存路径?

android - AGPBI : Error retrieving parent for item: No resource found

android - 未能在 JUnit (espresso) 记录测试中授予权限

android - AmbiguousViewMatcherException SimpleExoPlayerView Android

android - Espresso - 单击 gridview 中的图像

java - 错误 : Manifest merger failed with multiple errors, 查看日志