How to add background image in android studio

When designing an interface in Android Studio, it is often necessary to provide a page background image, so as to render the page and enrich the page effect. In Android Studio, we usually use the background attribute to refer to the image in a specific file to achieve the page effect. Specific steps as follows.

Step

Move the picture to the specified file. Open Android Studio and move the downloaded picture to the drawable file in the src directory of the project, and pay attention to changing it to an English name.

Refer to the file image through the background attribute. In the default layout tag of the activity_main.xml page, use the background attribute to reference the picture in the drawable file.

Check the effect. Click the button on the design interface on the right to switch pages and view the effect display after referencing the background image. If it succeeds, you can directly view it, if it fails, it will not display.

Precautions 

Note that the name of the picture cannot be local language characters or pure numbers, nor can it contain any special characters. Hope the above article is informative. To get more tutorials like this please visit us on our official web page.

Leave a Comment

Your email address will not be published. Required fields are marked *