Я новичок в ConstraintLayout, ниже мой xml-файл, в котором я пытаюсь динамически достичь ширины моего Textview.Если моя видимость @ + id / btn1 исчезла, TextView (@ + id / tv1) должен расшириться до полной ширины.Пожалуйста, предложите, какой подход я должен использовать, чтобы решить эту проблему таким же образом.
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/default_gap"
app:layout_anchorGravity="right">
<TextView
android:id="@+id/tv1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="First thing first, if you have a min SDK lower than 17, you can now shift to using only start and end attribute and don’t repeat yourself for right and left"
app:layout_constraintEnd_toEndOf="@+id/guideline_center"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/tv_cur_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RS"
app:layout_constraintTop_toBottomOf="@+id/tv1" />
<android.support.constraint.Guideline
android:id="@+id/guideline_center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5" />
<Button
android:id="@+id/btn1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/guideline_center" />
<TextView
android:id="@+id/tv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Payment Mode"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/guideline_center"
app:layout_constraintTop_toBottomOf="@+id/btn1" />
</android.support.constraint.ConstraintLayout>
Ниже приведен скриншот, введите описание изображения здесь как оно выглядит сейчас
Обязательный пользовательский интерфейс введите описание изображения здесь