Is there a way to restore a rotated Android WebView to the text position the user is at?

StackOverflow https://stackoverflow.com/questions/23125052

  •  05-07-2023
  •  | 
  •  

Domanda

Firstly, is there is a way to access the scroll bar state and reuse that?

Secondly, this might not work on rotate, however, as the switch between portrait and landscape would render the html differently. (Perhaps this is acceptable?) Since the html is local app-generated chunks of data (in this case a list of quotes) I could possibly inject anchor tags into the html if I can determine which chunk is top of focus. Or perhaps there is a way to get the current top line of text (assuming no duplicates) and magically translate that to a scroll bar position. Pros and cons?

I guess I'd like to do a little better than just re-launch the webview html at the top of the page.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top