3

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,501
  • 5
  • 28
  • 50
Furqan
  • 787
  • 2
  • 13
  • 28

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
  • 67,701
  • 16
  • 123
  • 163
Rohan Lodhi
  • 1,385
  • 9
  • 24