I want to create a layout that aligns the top of an image to the top of a TextView like this:
--------- Text text text text text text text
| Image | text text text text text text text
--------- text text text text text text text
text text text text text text text
text text text text text.
I tried doing this by setting android:drawableLeft
to my image, but that centers the image vertically:
Text text text text text text text
--------- text text text text text text text
| Image | text text text text text text text
--------- text text text text text text text
text text text text text.
Is this possible with just a TextView or do I need to create a RelativeLayout containing a TextView and an ImageView?
Here is the XML layout for my TextView that gives the incorrect layout:
<TextView
android:gravity="top"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/image"
android:drawablePadding="8dp"
android:text="@string/text" />
The android:gravity="top"
attribute only seems to affect the text, not the drawable.