How to put text on right centre of image view on constraint layout How to put text on right centre of image view on constraint layout xml xml

How to put text on right centre of image view on constraint layout


pls add one line in your textview

app:layout_constraintBottom_toBottomOf="@+id/img_apn_not_set"

also remove android:layout_marginTop="5dp"

hope it help you


Try this, If you want to move the text to the right or left use Horizontal bias, If you want to move your text to the top or bottom use vertical bias.

<TextView        android:id="@+id/tv_apn_not_set"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_marginBottom="8dp"        android:layout_marginEnd="8dp"        android:layout_marginStart="8dp"        android:layout_marginTop="8dp"        android:text="@string/app_name"        app:layout_constraintBottom_toBottomOf="@+id/img_apn_not_set"        app:layout_constraintEnd_toEndOf="@+id/img_apn_not_set"        app:layout_constraintHorizontal_bias="0.63"        app:layout_constraintStart_toStartOf="@+id/img_apn_not_set"        app:layout_constraintTop_toTopOf="@+id/img_apn_not_set" />


Try this

<?xml version="1.0" encoding="utf-8"?><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"    android:orientation="vertical">    <ImageView        android:id="@+id/AmountLabel"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:src="@drawable/ic_launcher_background"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintBaseline_toBaselineOf="@id/Amount"        app:layout_constraintTop_toTopOf="parent" />    <TextView        android:id="@+id/Amount"        android:layout_width="0dp"        android:layout_height="wrap_content"        android:layout_marginTop="40dp"        android:text="NILESH"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintHorizontal_bias="0.0"        app:layout_constraintStart_toEndOf="@id/AmountLabel"        app:layout_constraintTop_toTopOf="parent" /></android.support.constraint.ConstraintLayout>

RESULT

enter image description here