Thursday, November 12, 2015

Here's how to center a background image

To customize background image scaling create a resource like this:
<xml version="1.0" encoding="utf-8"?>
 <xmlns:android="http://schemas.android.com/apk/res/android"
    android:gravity="center"
    android:src="@drawable/my_bg_asset" />
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

No comments:

Post a Comment