I have one listView , the item contains two component imageView and textView and I am trying to set the text background inside the textView.
So I think if I am able to set the Textview width to wrap_content then it will be fine to use android:background tag.
What I did is set the textview width and height to wrap_content and it works only if I have a short text but If I have a long one some of the text will be out of the screen
<?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"
app:layout_constraintWidth_default="wrap"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout_editor_absoluteY="25dp"
tools:layout_editor_absoluteX="0dp">
<ImageView
    android:id="@+id/imageViewChat"
    android:layout_width="50dp"
    android:layout_height="50dp"
    app:srcCompat="@drawable/googleg_standard_color_18"
    android:layout_marginStart="16dp"
    app:layout_constraintTop_toTopOf="parent"
    android:layout_marginTop="26dp"
    android:layout_marginLeft="16dp"
    app:layout_constraintLeft_toLeftOf="parent" />
<TextView
    android:id="@+id/textViewChat"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginEnd="8dp"
    android:layout_marginLeft="8dp"
    android:layout_marginRight="16dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="26dp"
    android:background="@drawable/rounded_corner"
    android:fontFamily="serif"
    android:text="ssssss ssssss ssssss ssssss ssssss ssssss  ssssss 
    ssssss  ssssss ssssss "
    android:textAlignment="textStart"
    android:textColor="@color/bb_darkBackgroundColor"
    android:textSize="15sp"
    app:layout_constraintHorizontal_bias="0.0"
    app:layout_constraintLeft_toRightOf="@+id/imageViewChat"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
 
    