Question Detail

Insert Background Image in android studio

5 years ago Views 1304 Visit Post Reply

Trying to use below code to insert a background image in screen, where I am wrong here.. please help....

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".SplashScreen"
    android:background="@drawable/splash-bg-white">
    
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!" />

</RelativeLayout>

I had also inserted image in drawable...


Thread Reply

Anonymous

- 5 years ago

Image Name is not valid please remove - from your name 

In Android Studio you have to put in your drawable folder there should be images or source file name which is not start with any Number and - hifan in Name. You can use underscore instead of hifan