WebView jump to anchor using loadDataWithBaseUrl

后端 未结 5 1349
名媛妹妹
名媛妹妹 2021-01-02 10:25

My Android app uses a WebView to display a bunch of HTML code that I generate \'on the fly\'. The HTML code is loaded using the following code:



        
5条回答
  •  再見小時候
    2021-01-02 11:14

    if you load the html from the assets:

     webView.loadUrl("file:///android_asset/htmls/mypage.html#anchor");
    

    and you can move to the anchor inside a web page:

    webView.loadUrl("http://www.stackoverflow.com/mypage.html#anchor");
    

提交回复
热议问题