Имеется layout:
<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">
<Button
android:id="@+id/button10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="small text"
app:layout_constraintLeft_toLeftOf="parent"/>
<Button
android:ellipsize="end"
android:singleLine="true"
android:id="@+id/button11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="small text"
app:layout_constraintRight_toRightOf="parent"/>
</android.support.constraint.ConstraintLayout>
Отображается вот так:
Сейчас все нормально, но
если заменить
android:text="small text"
на android:text="big teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeext"
то вьюхи будут накладываться и перекрывать друг друга.
Задача сделать так, чтобы при маленьком тексте был "wrap content", как я собственно и показывал на скрине выше, но при большом тесте - вьюхи с текстом занимали бы максимум приблизительно 40 процентов от парента по горизонтали. Ну и также чтобы текст не переносился - я делаю android:ellipsize="end"
и android:singleLine="true"
.
Вот так должно быть (отредактировано в Фотошопе для демонстрации):
Есть ли средства для этого в ConstraintLayout или на худой конец - тогда другими лайоутами.