Inserting a Background Image

Often the backgrounds you see on apps are all images which are loaded into the project. It is very simple to add a background in, there are a few ways of doing so the first way i’m going to show you is though using android:background which will only change the background of one activity. 

1. Place the image you want to use in the res > drawable folder. 

Image

 

Once you have inserted the image into the drawable folder it then can be used as many times as you like. 

2. Go to the text layout of the page. 

Image

 

3. Insert the image into the layout of the page. This could be LinearLayout, GridLayout, FrameLayout etc. 

Within it write android:background=””. In the quotes is where the image reference is inserted. It should always start with @drawable/.

Mine for example looks like android:background”@drawable/ic_launcher”

Image

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s