I have an android activity that has an image overlaying a background image. The 2 images must line up(height only), so the height of the background image must not be scaled. However, on wide displays, i need to stretch the width of this background to fit the screen. Currently I have set the Activity background like this.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/layRoot"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/meditation_bg">
meditation_bg is a drawable resource. the code is
<?xml version="1.0" encoding="utf-8"?>
<bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/morn_blur_bg"
android:gravity="top|center"
android:scaleType="centerCrop"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
The bitmap drawable resource is required to prevent the OS from scaling the image for me.
How can I control the width, without affecting the height of the image.
cheers,