Android ListView y position

后端 未结 3 1576
予麋鹿
予麋鹿 2021-01-07 08:49

It seems like ListView doesn\'t expose its y-position in the same way a ScrollView does. In other words: I need to remember the exact position the ListView was scrolled to

3条回答
  •  Happy的楠姐
    2021-01-07 08:50

    Parcelable state = list.onSaveInstanceState();
    
    // do stuff
    
    list.onRestoreInstanceState(state);
    

    Is the only correct way I know of to maintain exact position of a list. The above solution that's marked as correct bumps up/down a few pixels so not really the most professional solution.

提交回复
热议问题