1

I am scratching my head with this...I have this layout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.company.app.LoginActivity"
android:background="@color/rojo">


<ImageView
    android:id="@+id/imageView2"
    android:layout_width="wrap_content"
    android:layout_height="140dp"
    app:srcCompat="@drawable/conway"
    android:layout_alignParentTop="true"
    android:layout_alignParentStart="true"
    android:layout_alignParentEnd="true" />

<EditText
    android:id="@+id/etusername"
    android:layout_width="wrap_content"
    android:layout_height="40dp"
    android:layout_below="@+id/imageView2"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="78dp"
    android:ems="10"
    android:inputType="textPersonName"
    android:text="@string/username"
    android:background="@color/blanco"/>

<EditText
    android:id="@+id/etpass"
    android:layout_width="wrap_content"
    android:layout_height="40dp"
    android:layout_alignStart="@+id/etusername"
    android:layout_below="@+id/etusername"
    android:layout_marginTop="41dp"
    android:ems="10"
    android:inputType="textPersonName"
    android:text="@string/password"
    android:background="@color/blanco"/>

<TextView
    android:id="@+id/tventrar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="30dp"
    android:text="@string/sendlogin"
    android:textColor="@color/blanco"
    android:textSize="25dp"
    android:layout_below="@+id/etpass"
    android:layout_centerHorizontal="true" />

<TextView
    android:id="@+id/tvlostpass"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/lostpass"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:textSize="25dp"
    android:textColor="@color/blanco"
    android:layout_marginBottom="20dp"/>


<View
    android:id="@+id/shade"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/blanco"
    android:visibility="invisible" />


</RelativeLayout>

Its a very simple login screen. I have an ImageView on top of the screen...but I can't see it when I run my app in a device. Why is that? How can I get my ImageView?

Thank you.

Fustigador
  • 6,339
  • 12
  • 59
  • 115

1 Answers1

4

Instead of:

 app:srcCompat="@drawable/conway"

use:

 android:src="@drawable/conway"

srcCompat attribute is defined within AppCompat library.

To know more about their difference Go through this Answer

Community
  • 1
  • 1
rafsanahmad007
  • 23,683
  • 6
  • 47
  • 62