user3932494
user3932494

Reputation: 47

Stretching an imageview, different on each screen

I have imageview with resolution of 430x871 in folders xxhdpi, xhdpi and hdpi. But when I run app, on 5" Xperia Z (xxhdpi) screen it works normally (1. picture) but on 4.7" Amazon Phone (xhdpi) it's smaller (2. picture). Altough when I run it on Amazon Fire HD 8.9 or 7 or 6, (all xdpi) it works too...

How can I stretch in on that Amazon Phone?

Picture 1 (Xperia Z)

Picture 2 (Amazon Phone)

Here is XML code of the Imageview:

<ImageView 
        android:id="@+id/matter"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:adjustViewBounds="true"
        android:gravity="center"
        android:src="@drawable/matter"
        />

Upvotes: 0

Views: 56

Answers (2)

Milad Faridnia
Milad Faridnia

Reputation: 9477

if aspect ratio is not important for you use:

android:scaleType="fitXY"

but if yes try this:

android:scaleType="fitCenter"

and also change this:

android:layout_height="match_parent"

Upvotes: 1

Sarthak Mittal
Sarthak Mittal

Reputation: 6104

There's a property called :

android:scaleType="fitXY"

inside ImageView tag.

Upvotes: 0

Related Questions