Pergunta

I'm looking for a way to scroll a webview that a specific part of the contained text is shown.

Scrolling programmatically needs always an integer value of how far to scroll. Is there any possibility of retrieving the y-position of a specific text in that webview?

Foi útil?

Solução

If you are the editor of the html content, you could simply use anchors inside the html :

The text I want to scroll to

and then simply use webview.loadurl("mywebpage.html#firstpart")

Outras dicas

WebView has the findAll(String) and findNext() methods. They're not well documented though, and they seem to have some issues pre-froyo.

This thread in particular may help you give it a try, though. These find methods call native code, so it's not something you could easily override, I don't think. There might be something you could do with Javascript, but that's certainly not something I'm familiar with.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top