Add a Progress Bar in WebView

前端 未结 8 1850
無奈伤痛
無奈伤痛 2020-11-27 15:50

I am trying to add a progress/loading bar to my application that uses WebView. I am confused on how to implement a progress bar that appears every time a link i

8条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-27 16:46

    Put a progress bar and the webview inside a relativelayout and set the properties for the progress bar as follows,

    1. Make its visibility as GONE.
    2. CENTRE it in the Relativelayout.

    and then in onPageStarted() of the webclient make the progress bar visible so that it shows the progressbar when you have clicked on a link. In onPageFinished() make the progress bar visiblility as GONE so that it disappears when the page has finished loading... This will work fine for your scenario. Hope this helps...

提交回复
热议问题