title: Android - ProgressBar setVisibility to GONE not working
body: <p>I've been adding a <code>ProgressBar</code> to the fragments in my app. I've set it up to the two main fragments (used as tabs) as follows:</p>
  
  <p><code>ProgressBar</code> in <code>activity_main.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/fragment_container"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;ProgressBar
          android:id="@+id/progressBar1"
          style="?android:attr/progressBarStyleLarge"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerHorizontal="true"
          android:layout_centerVertical="true" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Setting <code>ProgressBar</code> <code>VISIBLE</code> and <code>GONE</code>:</p>
  
  <pre><code>spinner = (ProgressBar)getActivity().findViewById(R.id.progressBar1);
  spinner.setVisibility(View.VISIBLE);
  
  spinner.setVisibility(View.GONE);
  </code></pre>
  
  <p>This works without any problems. I've tried to add another <code>ProgressBar</code> to another fragment which has a <code>WebView</code>:</p>
  
  <p><code>ProgressBar</code> in <code>fragment_article.xml</code>:</p>
  
  <pre><code>&lt;RelativeLayout 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="info.androidhive.slidingmenu.ArticleFragment$PlaceholderFragment" &gt;
  
      &lt;WebView android:id="@+id/webPage"
          android:layout_height="wrap_content"
          android:layout_width="wrap_content"/&gt;
  
      &lt;ProgressBar
          android:id="@+id/progressBar1"
          style="?android:attr/progressBarStyleLarge"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerHorizontal="true"
          android:layout_centerVertical="true" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Setting Visibility:</p>
  
  <pre><code>spinner = (ProgressBar)getActivity().findViewById(R.id.progressBar1);
  spinner.setVisibility(View.VISIBLE);
  
  spinner.setVisibility(View.GONE);
  </code></pre>
  
  <p>Setting the visibility the same way as the previous code but for some reason this is not setting the <code>ProgressBar</code> to <code>GONE</code>. Not sure what's wrong.</p>
  
  <p>I've tried using <code>clearAnimation</code> as suggested here <a href="https://stackoverflow.com/questions/7424371/android-setvisbility-to-gone-not-working-in-relativelayout">Android, setVisbility to gone not working in RelativeLayout</a> but still nothing.</p>
  
  <pre><code>spinner.clearAnimation();
  spinner.setVisibility(View.GONE);
  </code></pre>