Background image in Android Studio

1

I want to know how I can add a background image in an android studio application, I have read that it should be in the drawable folder; but I do not know how to add the image to that folder. The image is downloaded from the internet.

    
asked by JuanDuarte 05.06.2017 в 05:35
source

3 answers

5

Ctrl + c to the image you want after Ctrl + v in the resources> drawable folder. Then in the layout of the activity you click, in the properties you go to the background and look for the image (there are different types of background, one to put another image to put only one color ...) and go!

    
answered by 05.06.2017 / 05:44
source
1

Another option is to go to the drawable folder from the browser and paste the image in the drawable folder, then you can use it in any View as imageView, button, etc. (in the background property for example)

    
answered by 05.06.2017 в 06:06
1

You can use any image that you have inside your folder /drawable or /mipmap you can copy them in the folder you want:

In your layout you define the background as the background with the property:

android:background

for example assuming an image called android.jpg , if you have it stored in the / drawable directory, use:

android:background="@drawable/ic_launcher"

if it is inside the / mipmap directory, use:

android:background="@mipmap/ic_launcher"

for example:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"

    android:background="@drawable/android"

    android:padding="10dp"/>

and in this way you will have your background image:

    
answered by 05.06.2017 в 21:48