How do I insert a background image in an xml file? I would like to add a background image to my APK (for mobile phone), I have already found the xml file, but I don't know where to insert the ID of the image and also not whether android: background or android: icon Can someone help me? The XML is in the picture and btw sorry for the picture i dont know how to copy a xml code in the question
It's done with android:background=""
, like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/your_image_id">
</LinearLayout>
hey thank you, i have do this but its not working, its blackscreen :/
@xxyninaxxy If the size of the image does not fit your layout, it will definitely turn out to be a black screen, and make sure of the image that you put in. If you mean something else, please clarify.
I'm not a professional, I already have the app almost finished, only the backgrounds and the splash are missing, but I'm not familiar with that either. The problem is in the app are only colors as the background. I can change these colors as desired, but not in a picture .. and I don't quite understand the idea of inserting the picture. Is it possible to send you the APK and have a look at it?
@xxyninaxxy screenshot will be enogh,I want a picture of what it is and another picture of what you want to do