How to scroll gridview to position?

后端 未结 3 2023
挽巷
挽巷 2020-12-06 07:35

I have 30 images on grid view (3 images per row). If user select 20th image and go to next screen and come back then I want to focus to that position. I used following line

3条回答
  •  暖寄归人
    2020-12-06 07:48

    You can try somthing like this .I hope this will work for you..

    When selection happens do this save position

    int index = gridview.getFirstVisiblePosition();
    

    And when you come back to the gridview then you can try this

    gridview.smoothScrollToPosition(int index)
    

提交回复
热议问题