evenro
evenro

Reputation: 2646

Within a new activity, ViewImage does not show an image

I created an Activity, which I load from a fragment within my "main" activity. Within this new activity I placed an ImageView with an image from my drawable directory (I have about 10 other drawables I present the exact same way in the main activity).

The problem is that although in the IDE I see the image, it is not displayed in run time (via the simulator). -- to clarify, the image is static hence the difference compared to other questions (I'm not loading it by code).

Any ideas on how to solve it? My hunch is that it relates to the fact it's a new activity, but I'm new to android development, so I can't base it on any knowledge...

I did not add any code to the java section of the activity (didn't touch any "on.." nor added functionality to this specific file)

P.S. I tried cleaning the project, tried presenting an image that is presented on the main activity, and restarting anything that I can... nothing helped :(

My Activity xml is:

<?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="reducted">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <ImageView
            android:id="@+id/manageSubscriptionScreenLogo"
            android:layout_width="match_parent"
            android:layout_height="110dp"
            app:srcCompat="@drawable/managesubscription_header" />
    </LinearLayout>
</RelativeLayout>

How it looks in the IDE: enter image description here

And how it looks in run time:

enter image description here

Upvotes: 0

Views: 1420

Answers (1)

Suhayl SH
Suhayl SH

Reputation: 1223

Try using android:src="@drawable/managesubscrip_header" instead of app:srcCompat="@drawable/managesubscription_header" in ImageView to avoid automatic scaling of the drawable.

Let me know if it helps

Upvotes: 3

Related Questions