I'm flattening my layouts by employing the new ConstraintLayout (1.1.2) but I can no longer control the visibility of a ProgressBar when it's in a group. Here's the simplest version of my layout XML file which reproduces the issue:
<android.support.constraint.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<!-- This group prevents me from hiding ProgressBar -->
<android.support.constraint.Group
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="imageLoadingSpinner" />
<ProgressBar
android:id="@+id/imageLoadingSpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</android.support.constraint.ConstraintLayout>
I've introduced the Group in order to control some of the layout, although for simplicity I've left all that out. The essence of the bug is introducing the group prevents me from setting the ProgressBar's visibility to GONE
.
The following code no longer hides the ProgressBar:
find(R.id.imageLoadingSpinner).setVisibility(GONE);
To be clear, if I remove the group, as shown below, I can set the ProgressBar's visibility to GONE
:
<android.support.constraint.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<!-- Commenting out this group allows me to hide ProgressBar -->
<!--<android.support.constraint.Group-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--app:constraint_referenced_ids="imageLoadingSpinner" />-->
<ProgressBar
android:id="@+id/imageLoadingSpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</android.support.constraint.ConstraintLayout>
I can't find any information about this issue. ProgressBar visibility issue is unrelated.