Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image showing in Android Studio but not on phone

As you can see below this is what Android Studio shows:

enter image description here

However, when I run this app on my phone the List View shows with just a blank image (i.e - a space) above it where the "somewhere over the rainbow" should be.

The List View is working fine. It consists of one image view and 2 text views. (This image view is working if it helps). If any of this is possibly interfering then I will post the code here, but I find that hard to believe.

The one thing that I was unsure of was whether I could use relative view when defining the cells for the list view in the separate xml file. I don't see why not but it's the only thing that I could think of.

Basically Android studio shows everything working but on the phone/emulator it is not the case. Hence, I am finding it very hard to locate the problem.

I'm new to the Android development scene so go easy on me.

EDIT

The image is .png format and is located in the drawable folder. I also have another .png image in the drawable folder that seems to give no problems. Why is this the case? The original image is clearly not corrupt as it shows up in Android Studio

SOLUTION

Had to move image to "mipmap-xxhdpi" folder due to size

like image 729
Greg Peckory Avatar asked Jun 15 '15 11:06

Greg Peckory


3 Answers

I stumbled across the same issue and found the answer below: (Source: https://stackoverflow.com/a/40397892/7614252)

What I did to make it work is to change the automatic key assigned (populated via Drag/Drop ImageView) from app:srcCompat="@drawable/logo" to android:src="@drawable/logo" in Text tab to make it appear on both the emulator and the device e.g

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/logo"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="75dp"
    android:id="@+id/logoImageView"
    android:scaleType="fitXY"
    android:scaleX="1.5"
    android:scaleY="1.5" />
like image 186
Andre Alexandre Avatar answered Oct 30 '22 20:10

Andre Alexandre


I found same problem today . So first check height and width of image and based on it put image into different drawable folder. i.e If image size is 1280 x 840 than put image in drawable-xxhdpi folder.

like image 20
Anand Savjani Avatar answered Oct 30 '22 21:10

Anand Savjani


I recently had this same question, can you check which folder it is in. For me the problem was putting it inside the drawable folder, whilst it should be drawable-nodpi

Also state what device you're seeing this problem, is this multiple devices?

Image not appearing on HTC One M8

Here are relevant answers.

like image 45
Mathijs Segers Avatar answered Oct 30 '22 21:10

Mathijs Segers