Android, kann nicht sehen, meine app background-Bild

Ich habe ein problem mit dem hintergrund Bild von meiner app, ich habe es mit android:background="@drawable/image_name" und, auf den Vorschau des android studio funktioniert gut, aber, wenn ich bin mit der app kann ich nicht sehen, das Bild sondern nur ein weißer hintergrund, kann mir jemand helfen?

hier mein 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>
  • habe versucht diesen code, funktioniert Prima auf meinem Gerät, lollipop
  • Versuchen Sie, hintergrund ändern von code programmatisch wie hier stackoverflow.com/questions/12523005/...
  • welcher code? Sie vergaß es...
  • ich habe versucht auf diese Weise RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.relativeLayoutLogin); relativeLayout.setBackground(getResources().getDrawable(R.drawable.splash)); aber nicht funktioniert
  • es hat nicht funktioniert, weil Sie nicht die Namen Ihrer RelativeLayout-id als relativeLayoutLogin, müssen Sie das id-Attribut..
  • Können Sie mir sagen, die Größe der splash-Bild und in dem drawable Ordner, den Sie gehalten?
  • Bild erhältlich in alle drawable-Ordner oder nicht ?
  • Ja, das Bild ist in alle drawable-Ordner, die dimesion der Bilder sind die gleichen 752x1336 502x829 377x669 252x447 @DavidBalas ich muss hinzufügen das id-Attribut auf die relative layout, bevor Sie versuchen

Schreibe einen Kommentar