On a layout I want to scale the background image (keeping its aspect ratio) to the space allocated when the page gets created. Anyone have any idea how to do this?
I am using layout.setBackgroundDrawable() and am using a BitmapDrawable to setGravity for clipping and filling, but don't see any option for scaling.
To customize background image scaling create a resource like this:
<?xml version="1.0" encoding="utf-8"?> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:gravity="center" android:src="@drawable/list_bkgnd" />
Then it will be centered in the view if used as background. There are also other flags: http://developer.android.com/guide/topics/resources/drawable-resource.html