Home > Enterprise >  Android Studio: a picture is not displaying in the device but it does in the design
Android Studio: a picture is not displaying in the device but it does in the design

Time:05-23

I've added a sample picture into my app but it doesn't show on the device. What's wrong ?

enter image description here

CodePudding user response:

To display image, you should use app:srcCompat like the following.

<ImageView
            ...
            ...
            ...
            app:srcCompat="@drawable/resource_name" />

tools:srcCompat is responsible for showing the files in the IDE. It will not show the image in app.

Another approach to load image would be using Glide or Picasso library. You can find how to use them in their respective readme file.

  • Related