I'm trying to put an image at the top left of a LinearLayout
, but with the image border and padding taking up the whole of the width of the window.
If I try the XML below, I get my image with its border and a white background across the whole width of the page, except that the image ends up centered, and doesn't move to the left.
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:src="@drawable/banner"
android:background="@android:color/white"
android:padding="@dimen/d_8px"
/>
Is there some attribute that I've not yet discovered that forces the image to be left aligned within the ImageView
when the layout_width
is set to fill_parent
?
In the mean-time I've worked around this by dropping the ImageView
inside another LinearLayout
, and dropping an empty TextView
to its right that takes up the rest of the horizontal space.