I am trying to add a background image to a view. The image is really wide and not so tall. It’s 6400 x 480. I want the image to fill the android screen’s height and keep it’s aspect ratio. I cannot seem to get this to work.
<ImageView
android:id="@+id/background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/background"
android:scaleType="fitStart"
android:layout_alignParentBottom="true" />
Keep in mind I have tried all options with scaleType and it just doesn’t give the desired effect. I want to be able to move the image to the left revealing the rest of the image later on.
Any advice, tips would be great! Maybe I am going about this the wrong way.
I ended up finding the solution myself. I created an XML file named
background.xmlin my drawables folder and placed this code in it:Which created a bitmap object for use. I then add this
android:background="@drawable/background"to myRelativeLayouttag in my main.xml.Worked like a charm