I have a popup dialog in which I load webview. I want to show progressBar while the webview is loading on top of the popup. I found a way to show loading progress while the web page is loading, but if this web view is loading in a popup dialog, the progressBar does not appear on top of it. Can someone explain the reason why this is happening.
Here is the code
[the code]
@SuppressWarnings("static-access")
public void showPopUp(String url){
try{
Dialog dialog = new Dialog(Links.this);
LayoutInflater inflater = (LayoutInflater)getSystemService(Links.this.LAYOUT_INFLATER_SERVICE);
View vi = inflater.inflate(R.layout.link_popup, null);
dialog.setContentView(vi);
dialog.setTitle("Title here");
dialog.setCancelable(true);
WebView wb = (WebView) vi.findViewById(R.id.WebView01);
wb.setWebViewClient(new MyWebViewClient());
wb.getSettings().setJavaScriptEnabled(true);
wb.getSettings().setSupportZoom(true);
wb.loadUrl(url);
System.out.println("..loading url..");
dialog.show();
}catch(Exception e){
System.out.println("Exception while showing Agreement : " + e.getMessage());
}
}
[/the code]
It did not work, so I commented on this.
link_popup.xml
[the code]
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="fill"
android:id="@+id/layout_root"
android:background="#000000"
>
<ProgressBar
android:layout_width="fill_parent"
android:layout_height="5dip"
android:layout_alignParentTop="true"
style="?android:attr/progressBarStyleHorizontal"
android:id="@+id/progressbar_Horizontal"
android:max="100"
android:background="#228b22"
/>
<WebView
android:id="@+id/WebView01"
android:layout_below="@id/progressbar_Horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerVertical="true"
android:layout_centerInParent="true"
android:scrollbars="@null"
/>
</RelativeLayout>
[/the code]
James source
share