I have a problem with the background image of my app, I have set it with android:background="@drawable/image_name" and, on the preview of android studio, works fine, but, when i'm running the app, I can't see the image but only a white background, someone can help me?
here's my xml
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/splash"
tools:context="com.example.ivan.posteggiaTI.LoginActivity">
<com.facebook.login.widget.LoginButton
android:id="@+id/login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_above="@+id/editTextLoginEmail"
android:layout_centerHorizontal="true"
android:layout_marginBottom="48dp" />
<EditText
android:id="@+id/editTextLoginEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/login_edit_text"
android:hint="Email"
android:inputType="textEmailAddress"
android:paddingBottom="0dp"
android:paddingLeft="15dp"
android:paddingRight="10dp"
android:paddingTop="0dp"
android:textColor="#000000"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="22dp"
android:layout_above="@+id/editTextLoginPassword"
android:layout_alignParentStart="true" />
<EditText
android:id="@+id/editTextLoginPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/login_edit_text"
android:hint="Password"
android:inputType="textPassword"
android:paddingBottom="0dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:paddingTop="0dp"
android:textColor="#000000"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_above="@+id/textViewRegister"
android:layout_alignParentStart="true"
android:layout_marginBottom="34dp" />
<TextView
android:id="@+id/textViewRegister"
android:layout_width="160dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/button_blue_login"
android:gravity="center_vertical|center_horizontal"
android:text="Registrati"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#ffffff"
android:layout_alignTop="@+id/textViewLogin"
android:layout_toStartOf="@+id/textViewLogin" />
<TextView
android:id="@+id/textViewLogin"
android:layout_width="160dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/button_blue_login"
android:gravity="center_vertical|center_horizontal"
android:text="Login"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#ffffff"
android:layout_marginBottom="27dp"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true" /></RelativeLayout>
Sometimes android studio doesnt install the new apk while running. It bring the previous activity to front.
Follow the steps.
When you put your image in drawable folder. Aptly choose for which screen density you want which picture.
As there are drawable-ldpi,drawable-mdpi,drawable-hdpi etc... and a normal drawable folder. If android studio cant find a image in these qualifier drawable folder then it will look up in the normal drawable folder.