When running the application on the mobile phone the imageView is not visible

Asked

Viewed 9 times

1

<?xml version="1.0" encoding="utf-8"?>

<EditText
    android:id="@+id/editTextEmailEntry"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginStart="87dp"
    android:layout_marginLeft="87dp"
    android:layout_marginEnd="111dp"
    android:layout_marginRight="111dp"
    android:layout_marginBottom="27dp"
    android:autofillHints=""
    android:ems="10"
    android:hint="@string/tEmail"
    android:inputType="textEmailAddress"
    app:layout_constraintBottom_toTopOf="@+id/editTextPasswordEntry"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.0"
    app:layout_constraintStart_toStartOf="parent"
    tools:targetApi="o" />

<EditText
    android:id="@+id/editTextPasswordEntry"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="36dp"
    android:autofillHints=""
    android:ems="10"
    android:hint="@string/tPalavrapasse"
    android:inputType="textPassword"
    app:layout_constraintBottom_toTopOf="@+id/buttonPassRecovery"
    app:layout_constraintEnd_toEndOf="@+id/editTextEmailEntry"
    app:layout_constraintStart_toStartOf="@+id/editTextEmailEntry"
    tools:targetApi="o" />

<Button
    android:id="@+id/buttonProsseguir2"
    android:layout_width="0dp"
    android:layout_height="75dp"
    android:text="@string/bProsseguir"
    android:onClick="TelaSponsers"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent" />

<Button
    android:id="@+id/buttonPassRecovery"
    android:layout_width="174dp"
    android:layout_height="45dp"
    android:text="@string/bEsqueci"
    android:onClick="TelaEsqueci"
    app:layout_constraintBottom_toTopOf="@+id/buttonRegisto"
    app:layout_constraintEnd_toEndOf="@+id/buttonRegisto"
    app:layout_constraintStart_toStartOf="@+id/buttonRegisto" />

<Button
    android:id="@+id/buttonRegisto"
    android:layout_width="174dp"
    android:layout_height="45dp"
    android:layout_marginStart="112dp"
    android:layout_marginLeft="112dp"
    android:layout_marginEnd="125dp"
    android:layout_marginRight="125dp"
    android:layout_marginBottom="38dp"
    android:text="@string/bRegistar"
    android:onClick="TelaRegisto"
    app:layout_constraintBottom_toTopOf="@+id/buttonProsseguir2"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent" />

<ImageView
    android:id="@+id/icon"
    android:layout_width="141dp"
    android:layout_height="141dp"
    android:layout_marginStart="141dp"
    android:layout_marginLeft="141dp"
    android:layout_marginTop="48dp"
    android:layout_marginEnd="142dp"
    android:layout_marginRight="142dp"
    android:contentDescription="@string/icone"
    android:visibility="visible"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    tools:srcCompat="@tools:sample/avatars"
    tools:visibility="visible" />

Esta é a tela no Smartphone

Este é o Layout

1 answer

0

You are using the attribute tools to place the image.

How is it explained in the documentation, when using this attribute, you are setting a placeholder to be shown only in the preview.

Substitute tools:srcCompat for app:srcCompat that will work.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.