У меня есть EditText и TextView в моем ConstraintLayout. TextView отображает содержимое EditText.
При вводе мне нужно EditText, чтобы развернуть до середины экрана и TextView, чтобы следовать за ним и заполнить вторую половину.
![enter image description here](https://i.stack.imgur.com/NKJHG.gif)
Я установил ориентир на 50% и использую wrap_content и layout_constrainedWidth для обоих виджетов.
Вот мой xml:
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.manualuser.android.polygon.MainActivity">
<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:inputType="textNoSuggestions"
android:minWidth="1dp"
android:scrollHorizontally="true"
app:layout_constrainedWidth="true"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/guideline"
app:layout_constraintTop_toTopOf="parent"/>
<HorizontalScrollView
android:id="@+id/horizontalScrollView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="@+id/editText"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toRightOf="@+id/editText"
app:layout_constraintRight_toRightOf="parent">
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:maxLines="1"
android:scrollHorizontally="true"
android:singleLine="true"
app:layout_constrainedWidth="true"
app:layout_constraintBaseline_toBaselineOf="@+id/editText"
app:layout_constraintEnd_toStartOf="@+id/textView"
app:layout_constraintStart_toEndOf="@+id/editText"/>
</HorizontalScrollView>
<android.support.constraint.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5"/>
</android.support.constraint.ConstraintLayout>
Что я получаю, так это когда TextView достигает конца экрана и заменяет EditText слева.
![enter image description here](https://i.stack.imgur.com/gSCzr.gif)
Работает по мере необходимости, когда я устанавливаю TextView layout_width в match_constraint. Но как мне заставить его работать с wrap_content?