-1

I am creating a new UI in my code. Please refer to the below Picture. There are 3 views V1, V2 and V3. When V2 reaches to V3. The text has to go to the second line.

Can somebody help me out with this?

enter image description here

ADM
  • 20,406
  • 11
  • 52
  • 83
sukesh
  • 3
  • 1
  • 4
  • `When V2 reaches to V3. The text has to go to the second line` I don't think `ConstraintLayout` provides such arrangement . You can try using [FLowLayout or FlexboxLayout](https://stackoverflow.com/questions/4474237/how-can-i-do-something-like-a-flowlayout-in-android). – ADM May 21 '19 at 03:54

1 Answers1

0

You can do it by below code, textView's Gravity u can set what u want,

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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"
android:orientation="vertical">

<ImageView
    android:id="@+id/ivV1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    tools:src="@tools:sample/avatars" />

<TextView
    android:id="@+id/tvV2"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:gravity="start"
    android:text="nakld"
    app:layout_constraintEnd_toStartOf="@+id/ivV3"
    app:layout_constraintStart_toEndOf="@+id/ivV1"
    app:layout_constraintTop_toTopOf="parent" />

<ImageView
    android:id="@+id/ivV3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    tools:src="@tools:sample/avatars" />

</androidx.constraintlayout.widget.ConstraintLayout>
Akash Dubey
  • 1,508
  • 17
  • 34