本文介绍了浓咖啡:如何进行自定义滑动,例如在顶部滑动或在底部滑动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
到目前为止,我们可以做到:
So far we can do:
- swipeLeft
- swipeRight
- swipeUp
- swipeDown
我们如何swipeTop(一直到顶部)或swipeBottom(一直到底部)是表情.如果这些方法已经存在,请举个例子.
How can we swipeTop(all the way to the Top) or swipeBottom(all the way to the bottom) is expresso. Please give me an example if these methods already exists.
推荐答案
您是否尝试过这样的GeneralSwipeAction
?
private static ViewAction swipeFromTopToBottom() {
return new GeneralSwipeAction(Swipe.FAST, GeneralLocation.TOP_CENTER,
GeneralLocation.BOTTOM_CENTER, Press.FINGER);
}
也许您必须为第二个和/或第三个参数提供自定义实现,就像安娜已经提到的那样:
Maybe you have to provide a custom implementation for the second and/or third parameter, as Anna already mentioned:
new CoordinatesProvider() {
@Override
public float[] calculateCoordinates(View view) {
float[] coordinates = GeneralLocation.CENTER.calculateCoordinates(view);
coordinates[1] = 0;
return coordinates;
}
}
这篇关于浓咖啡:如何进行自定义滑动,例如在顶部滑动或在底部滑动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!