Search code examples
javaandroidandroid-layoutimageviewdrawable

Imageview is not showing my image?


My image shows on Android Studio itself, but when uploading to my phone the image is gone. Maybe it's a too big image? It's 1900 x 1250 pixels.

I have no idea what I'm doing wrong..

enter image description here

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="About"
    android:id="@+id/button"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:backgroundTint="#fed136" />

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Portfolio"
    android:id="@+id/button3"
    android:backgroundTint="#fed136"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true" />

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Contact"
    android:id="@+id/button4"
    android:layout_alignBottom="@+id/button3"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"
    android:backgroundTint="#fed136" />

<ImageView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/imageView"
    android:layout_below="@+id/button3"
    android:scaleType="fitXY"
    android:src="@drawable/header" />


Solution

  • Yes, the layout looks okay. Try to place the image in drawable-xxxhdpi folder. Create a folder inside your res folder and name it drawable-xxhdpi if its not there. Place the large image inside this folder and check if that helps.

    If not, please resize your image as this is the only problem you've here I guess. Too large image causes out of memory error in low-end devices.