Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to scale image correctly for Android app?
    primarykey
    data
    text
    <p>I don't understand how to scale images correctly in android. I have a picture for an iPhone app that's 640*125 pixels. I need to use this in an Android app but i don't get how to scale it correct.</p> <p>In the image below I use 'FitEnd' as ScaleType, this looks OK apart from the height which is approximately twice the size it should be (it should only be as high as the highest part of the grey figure).</p> <p>How do I fix this?</p> <p><img src="https://i.stack.imgur.com/29Ic6.png" alt="Selection shows the image i need to scale "></p> <p>Edit: including .xml</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;ViewFlipper android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/buttonrow" &gt; &lt;ViewFlipper android:id="@+id/flipper" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;include android:id="@+id/first" layout="@layout/activity_events" /&gt; &lt;include android:id="@+id/second" layout="@layout/event_detail" /&gt; &lt;/ViewFlipper&gt; &lt;include android:id="@+id/second" layout="@layout/event_detail" /&gt; &lt;/ViewFlipper&gt; &lt;RelativeLayout android:id="@+id/buttonrow" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" &gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:scaleType="fitEnd" android:src="@drawable/bottombar" /&gt; &lt;/RelativeLayout&gt; &lt;/RelativeLayout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    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