title: Adding ProgressBar into WebView Fragment
body: <p>i'm finishing my app, is a simple app that contains some WebView Fragments and a Navigation Drawer, everything is OK, but I don't know how to add a progress bar while the WebView is loading a page, all I got is a blank screen before the page loads.</p>
  
  <p>Here is my code...</p>
  
  <p>HomeFragment.java</p>
  
  <pre><code>public class HomeFragment extends Fragment {
  
  
  private WebView webView;
  
  
  public HomeFragment() {
      // Required empty public constructor
  }
  
  @Override
  public void onAttach(Activity activity) {
      super.onAttach(activity);
  }
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  }
  
  
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      View mainView = (View) inflater.inflate(R.layout.fragment_my_fragment1, container, false);
      WebView webView = (WebView)mainView.findViewById(R.id.webview);
      webView.setWebViewClient(new MantenerDominioWeb());
      webView.getSettings().setJavaScriptEnabled(true);
      webView.getSettings().setBuiltInZoomControls(false);
      webView.getSettings().setSupportZoom(false);
      webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
      webView.getSettings().setAllowFileAccess(true);
      webView.getSettings().setDomStorageEnabled(true);
      webView.canGoBack();
      webView.goBack();
      webView.loadUrl("http://www.lfcchile.com/");
      return mainView;
  
  
  }
  
  
  
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
      super.onActivityCreated(savedInstanceState);
  }
  
  @Override
  public void onDestroy() {
      super.onDestroy();
  }
  
  @Override
  public void onDetach() {
      super.onDetach();
  }
  }
  </code></pre>
  
  <p>My WebViewClient class</p>
  
  <pre><code>public class MantenerDominioWeb extends WebViewClient {
  
  private WebView webView;
  public ProgressBar progressBarT4;
  
  
  @Override
  public boolean shouldOverrideUrlLoading(WebView view, String url) {
      if (Uri.parse(url).getHost().endsWith("lfcchile.com") || (Uri.parse(url).getHost().endsWith("thisisanfield.com")) || (Uri.parse(url).getHost().endsWith("liverpoolecho.co.uk")) || (Uri.parse(url).getHost().endsWith("liverpoolfc.com"))) {
          return false;
      }
  
      Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
      view.getContext().startActivity(intent);
      return true;
  }
  
  }
  </code></pre>
  
  <p>And my Frame XML</p>
  
  <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
  android:layout_height="match_parent" tools:context="com.lfcchile.MyFragment1"&gt;
  
  &lt;!-- TODO: Update blank fragment layout --&gt;
  &lt;TextView android:layout_width="match_parent" android:layout_height="match_parent"
      android:gravity="center"
      android:text="@string/homefrag" /&gt;
  
  &lt;WebView
      android:id="@+id/webview"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" /&gt;
  
  &lt;ProgressBar
  android:layout_height="wrap_content"
  android:layout_width="wrap_content"
  android:layout_gravity="center"
  android:id="@+id/progressBar1"/&gt;
  
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>Any ideas please? I tried to put the progressBar "in front" of the WebView, but when the page is loaded the icon doesn't dissapear...</p>