Android develops a method to accurately save and restore the scroll position of list controls (recommended)

Android developers often need to save and restore the scrolling position of the list. There are many methods articles on this function on the Internet, but most of them can only be saved and restored to a certain line, and can not be accurately restored when scrolling to half a line. There are also many articles that introduce several methods, saying that some methods can be accurately controlled, but they can not be realized at all. Others introduce many mysterious and very complex methods, but they don't see the code that can be fully implemented.

After a period of research and testing, the following code can perfectly save and restore the scroll position of the list, and only add 2 lines of code on the basis of the original memory to the line position.

See the following codes and notes for details:

The above Android development method to accurately save and restore the scroll position of list controls (recommended) is all the content shared by Xiaobian. I hope it can give you a reference and support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>