0

Как сделать так, чтобы когда в costTv будет допустим несколько тысяч знаков, этот элемент не налазил на value ?

value должен быть неподвижен.

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">

<TextView
    app:layout_constraintStart_toStartOf="parent"
    android:id="@+id/value"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginStart="8dp"
   app:layout_constraintTop_toTopOf="parent"
    tools:text="125339395d32" />

<TextView
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    android:id="@+id/costTv"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginEnd="8dp"
    android:layout_marginStart="8dp"
    tools:text="km" />

   </androidx.constraintlayout.widget.ConstraintLayout>

1 ответ 1

1

См. доки здесь

<TextView
    android:id="@+id/costTv"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginEnd="8dp"
    app:layout_constrainedWidth="true"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="1.0"
    app:layout_constraintStart_toEndOf="@+id/value"
    app:layout_constraintTop_toTopOf="parent"
    tools:text="@tools:sample/lorem" />

app:layout_constrainedWidth="true" не дает залезать за ограничение app:layout_constraintStart_toEndOf="@+id/value".
app:layout_constraintHorizontal_bias="1.0" прижимает к правому краю.

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.