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距離

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章