skip to Main Content

Images shown in Android studio disapear in the emulator :
More than words, you can see thus screenshot explicit:

Code:

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"

    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/signorGrey">

    <ImageView
        android:id="@+id/logoSignor"
        android:layout_width="65dp"
        android:layout_height="77dp"
        app:srcCompat="@drawable/iconpetit2929"
        android:gravity="start|center_vertical"
        android:background="@color/signorBlue"
        android:visibility="visible"
        android:contentDescription="@string/logosignor"/>

Do you know why ?

2

Answers


  1. Check your logcat you maybe getting some error like "bitmap too large" if that so your image can not be implemented try to change the width and height of image

    Login or Signup to reply.
  2. I had this problem before and as a solution, I solved the path of the photo by using src instead of srcCompat. I suggest you use it like this;

    <ImageView
                        android:id="@+id/logoSignor"
                        android:layout_width="65dp"
                        android:layout_height="77dp"
                        android:src="@drawable/iconpetit2929"
                        android:gravity="start|center_vertical"
                        android:background="@color/signorBlue"
                        android:visibility="visible"
                        android:contentDescription="@string/logosignor"/>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search