Xamarin – Image Background for Layout in Android
In this post we would see, how to change the default black background of the Activity in android.
Actually, it’s not the activity whose background could be changed; it’s the layout whose background could be changed.
Sayings so, let’s add a background image to the Resources à Drawable folder.
As you see, in the above image, we have added an image to the folder. Remember that, the image has to be your target device resolution specific. If you do not give a specific resolution image, there is possibility that the image might be stretched or cropped or even compressed.
As in this sample we would test on the 480×800 resolution, we have selected the above image.
Now go to the layout which background you would lie to change. In this sample we would go to the Main.axml
As you see in the above image, we are taking the parent element and adding the android:background attribute.
And here is the result.
Hope you like this quick post, thanks for reading.
Full Source Code: Click Here