Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid - Webview Progressbar
    text
    copied!<p>I have added the progressbar above the webview. Whenever the i click a link, I just made the progressbar to visible.</p> <p>I want to have the progressbar overlay on the webview and i want to show the percentage of progress bar. I know css, but i don't know how to change the position of progressbar in android</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;WebView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/webview01" android:layout_width="fill_parent" android:layout_height="fill_parent" /&gt; </code></pre> <p>MainActivity.java</p> <pre><code>public class MainActivity extends Activity { WebView web; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); web = (WebView) findViewById(R.id.webview01); // request the progress-bar feature for the activity getWindow().requestFeature(Window.FEATURE_PROGRESS); // set a webChromeClient to track progress web.setWebChromeClient(new WebChromeClient() { public void onProgressChanged(WebView view, int progress) { // update the progressBar MainActivity.this.setProgress(progress * 100); } }); web.getSettings().setJavaScriptEnabled(true); web.loadUrl("url"); } // To handle "Back" key press event for WebView to go back to previous screen. @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) &amp;&amp; web.canGoBack()) { web.goBack(); return true; } return super.onKeyDown(keyCode, event); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } </code></pre> <p>}</p> <p>To display progressbar percentage, do i need to modify this code? or can i extend the functionality from this code?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload