I have an image which is 450px square below some text in a linear layout and wanted it to fill the width of the device, which I done by using;
ImageView android:id="@+id/my_image_container"
android:src="@drawable/my_image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/orange"
android:scaleType="fitStart"
This has worked in a fashion, but the ImageView element fills the rest of the screen and any elements placed under do not show.
Does anyone know of a way to trim the bottom of the space that the ImageView uses.
Hopefully this image can explain it better - I want to crop the empty area under the im开发者_运维问答age (orange background).
I recommend you to use a RelativeLayout
instead of a LinearLayout
. You can then use android:layout_above=""
and android:layout_below=""
to ensure that you get the layout you want.
精彩评论