我有RecyclerView
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/dashboard_swiperefreshlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/events_dashboard_listview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"/>
</android.support.v4.widget.SwipeRefreshLayout>Viewpager在Viewpager中是片段。我使用volley进行带有自定义IdleResurs的服务器调用。
我想打开抽屉:
openDrawer(R.id.drawer_layout);
isOpen();但测试挂起时出现错误:
Could not launch intent Intent within 45 seconds如果我手动滚动RecycleView或更改适配器中的可见页面,测试将继续并打开抽屉。
发布于 2017-07-12 18:44:25
可能会显示SwipeRefreshLayout的加载指示符,并且因此阻塞UI,因为它是动画的。避免显示动画的布局的一个快速解决方案是使用如下所示的内容:
class TestableSwipeRefreshLayout : SwipeRefreshLayout {
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
companion object {
var isTestRunning = false
}
override fun setRefreshing(refreshing: Boolean) {
if (!isTestRunning) {
super.setRefreshing(refreshing)
}
}
}https://stackoverflow.com/questions/42650483
复制相似问题