Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: OS not re-sizing images with the same scale
    primarykey
    data
    text
    <p>I am troubled by how the Android OS is handling resizing on an app of mine. Basically I have a background image that is 480x800 (so 480px wide) and an image that goes at the bottom, also 480px wide.</p> <p>On the Galaxy S (480x800 screen) everything looks fine, as shown below:</p> <p><img src="https://i.stack.imgur.com/HsSgz.png" alt="enter image description here"></p> <p>On the Galaxy S3 (720x1280), however, the background is getting stretched to 720px wide but the image at the bottom only to 640px wide, as shown below:</p> <p><img src="https://i.stack.imgur.com/DfJPa.png" alt="enter image description here"></p> <p>I tried to create a xhdpi folder with 640x960 images, but same thing happens (background stretched to 720px, image only to 640px). I also tried to play with "ScaleType", but no luck so far.</p> <p>Does anyone know why the OS would re-size the two images with a different scale, and how to fix it?</p> <p>Here's the XML:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="@drawable/bg" &gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/significados" android:layout_gravity="center" android:layout_marginTop="216dp" android:onClick="goToSignificados" /&gt; &lt;Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/ranking" android:layout_gravity="center" android:onClick="goToRanking" /&gt; &lt;Button android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/engracados" android:layout_gravity="center" android:onClick="goToEngracados" /&gt; &lt;ImageView android:id="@+id/iv1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginTop="60dp" android:clickable="true" android:contentDescription="@string/image" android:onClick="goToMarket" android:src="@drawable/googleplay" /&gt; &lt;/LinearLayout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload