Skip to content Skip to sidebar Skip to footer

Android Picture In Background

Hi, I have no clue how to go about this but I want to put in the background of all the screens a picture instead of it being black. How would I do this through XML or the Java code

Solution 1:

Just add android:background="@drawable/your_image"to the root layout of your XML. It will be stretched to fill all the screen, so if your image doesn't perfectly match the screen size you'll need to create another BitmapDrawable XML in which you declare the properties of the image.

Solution 2:

You can use the following attribute on some ViewGroup layout objects (like LinearLayout and RelativeLayout):

android:background="@drawable/YOUR_IMAGE_RESOURCE_HERE"

Make sure to set your layout_height and layout_width to fill_parent on the root View and set this attribute on it if you want the background to fill the screen.

Solution 3:

First you would create a style with the background set to your image. Then you would use the android:theme attribute on your application to apply the style to all the activities in your application. For more information, please read Style and Themes.

Post a Comment for "Android Picture In Background"