Note that there are some explanatory texts on larger screens.

plurals
  1. POImageView doesn't scale on large screen devices
    primarykey
    data
    text
    <p>Here is my basic layout:</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"&gt; &lt;ImageView android:adjustViewBounds="true" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/welcome_hero" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>I want the Image to scale while maintaining the aspect ratio to fit the screen, pushing any following views down.</p> <p>This works just beautifully on my mdpi (LG LGP509) and hdpi (HTC G2, Nexus One) devices. However, on my Galaxy Nexus (xhdpi), the image stubbornly does not scale to fit. It leaves extra space on the sides.</p> <p>Here is some more info:</p> <ul> <li><p>the layout is in the generic layout/ folder</p></li> <li><p>welcome_hero.png is in the drawables/ folder and has 320px width and 161px height</p></li> </ul> <p>AndroidManifest.xml has this entry:</p> <pre><code>&lt;uses-sdk android:targetSdkVersion="10" android:minSdkVersion="8" /&gt; &lt;supports-screens android:xlargeScreens="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="false" /&gt; </code></pre> <p>Some things I have tried:</p> <ul> <li>changing the scaleType to fitCenter, fitInside, or matrix yielded the same results as without</li> <li>changing ImageView height to fill_parent correctly scaled the image, but pushed all other views off screen</li> <li>threatening monitor with physical violence left me more frustrated</li> <li>explicitly set height and width to 320dp and 161dp changed nothing</li> <li>as mentioned above, I have tried new layouts both in IntelliJ's previewer and on physical devices</li> </ul> <p>I have been going through StackOverflow for about 1.5 hours now looking at the hundreds of posts that seem similar to mine, but none seem to make things work on the Galaxy Nexus. I am trying desperately to be a good developer and make my stuff scale up to new phones, but this is proving to be difficult.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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