2

I have a textView with an image and text, I want to align text with the baseline of the image. I am trying but unable to do this. How can I do this? Thanks in advance.

<TextView
    android:id="@+id/date"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:drawablePadding="4dp"
    android:text="Hello"
    android:drawableStart="@drawable/date"
    android:gravity="bottom"
    android:textColor="@color/black"
    android:textSize="10sp" />

Textview with image

I want to text and image like this, they share the same baseline:

enter image description here

Faysal Ahmed
  • 7,003
  • 5
  • 27
  • 47
Furqan
  • 777
  • 2
  • 13
  • 27

1 Answers1

-2

Try Below:

Use android:drawableTop to set Image at top.

 <TextView
        android:id="@+id/news_detail"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:ellipsize="end"
        android:maxLines="3"
        android:drawableTop="@drawable/progress_image"
        android:textColor="@color/black"
        android:text="Below Text"
        android:textSize="10sp" />
AskNilesh
  • 63,753
  • 16
  • 113
  • 150
Rohan Lodhi
  • 1,320
  • 8
  • 23