ListView指定垂直滑动距离

1、public void smoothScrollToPosition (int position)平滑滚动到指定适配器位置。 视图会滚动以显示指定位置的视图。参数position 滚动到的适配器位置


2、public void smoothScrollToPosition (int position, int boundPosition)平滑滚动到指定的适配器位置。 视图会滚动到指定位置显示出来, 如果滚动会使 boundPosition 滚动到视图外,滚动会先被停止。参数position 要滚动到的适配器位置。boundPosition 如果要将这个适配器位置移出视图,滚动会停止。


3、public void smoothScrollToPositionFromTop (int position, int offset, int duration)平滑滚动到指定的适配器位置。 指定位置的视图会滚动到相对顶边偏移 offset 像素的位置显示。 如果无法做到(比如该偏移量会使首尾条目超越列表边缘),会滚动到尽量接近的位置。 滚动需要持续 duration 毫秒来完成。参数position 滚动到的位置offset 滚动结束时,指定 position 条目距离视图顶部的像素数duration 滚动执行的毫秒数


4、public void smoothScrollToPositionFromTop (int position, int offset)平滑滚动到指定的适配器位置。 指定位置的视图会滚动到相对顶边偏移 offset 像素的位置显示。 如果无法做到(比如该偏移量会使首尾条目超越列表边缘),会滚动到尽量接近的位置。参数position 滚动到的位置offset 滚动结束时,指定 position 条目距离视图顶部的像素数

5、public void setSelection(int position),设置ListView选中的位置,Y轴偏移量为0,没有滚动动画

6、public void setSelectionAfterHeaderView()跳到第一个pisition位置,即回到顶部

7、public void setSelectionFromTop(int position, int y)设置ListView选中的位置,同时在Y轴设置一个偏移量

8、public void smoothScrollByOffset(int offset)滚动到指定position位置

9、public void smoothScrollBy(int distance, int duration)花费duration时间滚动distance距离

猜你喜欢

转载自blog.csdn.net/a2923790861/article/details/79589405