Если вы хотите избежать выталкивания другого вида из экрана, не используйте android:layout_width="wrap_content"
.
Вы можете использовать app:layout_constraintWidth_percent="0.x"
, чтобы указать, что ваш вид равен некоторому проценту ширины экрана.
Например, поместите это в свой constraintLayout:
<TextView
android:id="@+id/textView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:ellipsize="end"
android:maxLines="1"
android:text="this is long text this is long text this is long text thisthis is long text this is long text this is long text thisthis is long text this is long text this is long text this"
android:textColor="@color/colorPrimaryDark"
app:layout_constraintEnd_toStartOf="@+id/textView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.5" />
<TextView
android:id="@+id/textView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="TextView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textView2"
app:layout_constraintTop_toTopOf="@id/textView2" />
Это будет выглядеть так:
И если вы хотите включить расширение textView, просто удалите android:maxLines="1"