Search code examples
androidimageimageviewscreen-resolutionandroid-version

Android - ImageView not showing on certain phones


The ImageView doesn't seem to be showing for older phones. It shows up fine on my S6 Edge and HTC M9. However when I try it on a S3 or HTC M7 the ImageView doesn't appear.

I tried creating an AVD using a 4.7" screen and versions 5.0.2 but the image is showing up fine on the emulator so I'm not sure what it could be. The reason I went with 4.7" and 5.0.2 is because the S3 and M7 were around those specs.

I've got the image in the drawables folder, with 5 different versions (hdpi, mdpi, xhdpi, xxhdpi & xxxhdpi. My XML is as below:

<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/logo"
    android:layout_centerInParent="true"
    android:id="@+id/splashImage"/>

Does anyone have any ideas as to why the ImageView is not appearing on those phones but it is appearing on the emulators with similar specs and newer phones?


Solution

  • Set following line of code in AndroidManifest.xml file in the Application tag.

                      android:hardwareAccelerated="false"