1

An image I use (.jpg) in my Android Project is shown in the "Design" but when I start an emulator, it is not there. Other images are also not loaded.

I found some possible solutions Image showing in Android Studio but not on phone but none of the solutions worked in my case. To sum up, I tried:

  • moving image to a drawable-xxhdpi or mipmap--xxhdpi
  • using other image and also a different format (.png)
  • adding android:adjustViewBounds="true"
  • clean/rebuild project etc

No success. I work on OS X

Code:

<?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"
>

<LinearLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/background_light">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:srcCompat="@drawable/testimage"
        android:id="@+id/imageView"
        />

    <TextView
        android:text="test"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/textView2"
        android:textAlignment="center" />

</LinearLayout>
</RelativeLayout>
Community
  • 1
  • 1
kjdkfjsdo8
  • 97
  • 12
  • 1
    are you using vector drawable ? if not then try `android:background="@drawable/testimage"` – Pavneet_Singh Jan 06 '17 at 14:45
  • It happens to me too, i have a wallpaper on a drawable folder, it is set as Background in a relative layout and for some reasons, in some devices it is shown as a blank one – kevinrodriguez-io Jan 06 '17 at 15:25

0 Answers0