I'm just trying to use the group view with the android constraint layout to set the visibility of several views more easily. Problem is even though I change the visibility of a group to gone or invisible it does not do anything.
I'v already tried the steps of Pavan's response in this thread: toggle visibility of chain group in constraint layout. But it didn't change anything for me. (I assume it's because I'm not using the beta version)
Here is my dependencies app gradle file
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
This is an extract of my XML file with the group
<Button
android:text="@string/action_update"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/button_update"
android:layout_marginBottom="32dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp" android:layout_marginRight="8dp"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp" app:layout_constraintStart_toStartOf="parent" android:textSize="18sp"/>
<android.support.constraint.Group android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/group"
android:visibility="gone"
app:constraint_referenced_ids="button_update"/>
The thing is I didn't notice that when I created my android studio project, i didn't check the box "Use androidx artifacts" which automatically makes your project use the new androidx library. Androidx tends to replace the support library (See more details here: https://developer.android.com/jetpack/androidx)
So basically, I followed the steps given here to convert my project to androidx and now everything is working perfectly.
Thank for your time @theapache64, now your code is working.