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>