title: Android Widget Visibility strategy
body: <p>I am facing a situation I am struggling to solve.</p>
  
  <p>I have in my layout 2 widget. One ImageView and one ProgressBar (Indeterminate).</p>
  
  <p>I want to show the progressbar until my ImageView image load.</p>
  
  <p>The problem is ImageView fill all the area and Progressbar has a specific size. When I set the progressbar visibility to INVISIBLE or GONE, the progressbar doesn't appear anymore but her size still fill some area which makes Imageview not fill all area.</p>
  
  <p>How to set progressbar invisible and put ImageView on top ?</p>
  
  <p>Layout</p>
  
  <p></p>
  
  <pre><code>&lt;LinearLayout
      android:id="@+id/linear_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/bck_card_layout"
      android:orientation="vertical"
      android:padding="2dp"
      android:weightSum="1"&gt;
  
      &lt;TextView
          android:id="@+id/title"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:drawableEnd="@drawable/ic_medal"
          android:drawablePadding="12dp"
          android:fontFamily="sans-serif-light"
          android:paddingBottom="8dp"
          android:paddingEnd="12dp"
          android:paddingStart="12dp"
          android:paddingTop="8dp"
          android:singleLine="true"
          android:textColor="@color/textPrimary"
          android:textSize="@dimen/text_regular" /&gt;
  
      &lt;View
          android:layout_width="match_parent"
          android:layout_height="2dp"
          android:background="@color/colorAccent" /&gt;
  
  
      &lt;ProgressBar
          android:id="@+id/card_progressbar"
          android:visibility="visible"
          android:layout_gravity="center_horizontal|center_vertical"
          android:layout_width="30dp"
          android:layout_height="30dp"
          android:indeterminate="true" /&gt;
  
  
      &lt;ImageView
          android:id="@+id/image"
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:layout_weight="1"
          android:scaleType="centerCrop" /&gt;
  
      &lt;View
          android:layout_width="match_parent"
          android:layout_height="2dp"
          android:background="@color/colorAccent" /&gt;
  
      &lt;FrameLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:paddingEnd="12dp"
          android:paddingStart="12dp"&gt;
  
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="start|center_vertical"
              android:fontFamily="sans-serif-light"
              android:paddingBottom="6dp"
              android:paddingTop="6dp"
              android:text="@string/lunch_per_kilo"
              android:textColor="@color/textPrimary"
              android:textSize="@dimen/text_regular" /&gt;
  
          &lt;TextView
              android:id="@+id/price"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="end|center_vertical"
              android:ellipsize="start"
              android:paddingStart="116dp"
              android:singleLine="true"
              android:textColor="@color/textSecondary"
              android:textSize="@dimen/text_xlarge"
              android:textStyle="bold" /&gt;
      &lt;/FrameLayout&gt;
  
      &lt;View
          android:layout_width="match_parent"
          android:layout_height="2dp"
          android:background="@color/colorAccent" /&gt;
  
      &lt;FrameLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:paddingEnd="12dp"
          android:paddingStart="12dp"&gt;
  
          &lt;TextView
              android:id="@+id/valid_until"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="start|center_vertical"
              android:drawablePadding="8dp"
              android:drawableStart="@drawable/ic_flash"
              android:fontFamily="sans-serif-light"
              android:gravity="center_vertical"
              android:includeFontPadding="false"
              android:paddingBottom="8dp"
              android:paddingTop="8dp"
              android:textColor="@color/textPrimary"
              android:textSize="@dimen/text_small"
              android:textStyle="italic" /&gt;
  
          &lt;TextView
              android:id="@+id/like_counter"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="end|center_vertical"
              android:drawablePadding="8dp"
              android:drawableStart="@drawable/ic_heart_24dp"
              android:fontFamily="sans-serif-thin"
              android:singleLine="true"
              android:textColor="@color/textSecondary"
              android:textSize="@dimen/text_regular" /&gt;
      &lt;/FrameLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>