Android Espresso使用自定义时间进行点击

huangapple go评论68阅读模式
英文:

Android espresso click with custom time

问题

在 androidx.test.espresso.action 中的 ViewAction 类中有 click()longClick()

如何创建相同的 longClick(),但具有自定义的点击时间?

英文:

There is click() and longClick() in ViewAction class in androidx.test.espresso.action.

How can I create the same longClick() but with custom click time?

答案1

得分: 1

你需要实现自己的 Tap 枚举,类似于 androidx.test.espresso.action.Tap 枚举。在其中声明你的自定义点击操作,并更新这一行代码:long longPressTimeout = (long) (ViewConfiguration.getLongPressTimeout() * 1.5f);,使用你自己的时间。

然后创建一个自定义的点击操作,该操作将使用你的自定义点击方式。

英文:

You have to implement your custom Tap enum similar to androidx.test.espresso.action.Tap enum. Declare your custom tap action inside and update this line long longPressTimeout = (long) (ViewConfiguration.getLongPressTimeout() * 1.5f); with your time.

Then create a custom click action that will use your custom tap.

huangapple
  • 本文由 发表于 2020年9月11日 20:18:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/63846963.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定