I need to have a screen with an image laid out along the bottom of the screen. The image itself is fixed (from resources). It's quite large and is scaled down to the width of each device. I tried to use simple layout_alignParentBottom, like so:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LayoutLoading"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/startup" >
<ImageView
android:id="@+id/ImageView01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:scaleType="fitCenter"
android:src="@drawable/loading" />
</RelativeLayout>
Yes, this didn't work. Unless I specify exact height of the image (in place of wrap_content), the ImageView is not aligned at the bottom. Most likely this is due to the fact that the actual image is higher than the screen size and becomes "shorter" only after scaled down to the width of the screen.
So, the question is how do I get the ImageView to stay at the bottom of the screen regardless of the size of the device?
add to your imageview in xml android:adjustViewBounds="true"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With