views:

658

answers:

2

Hi,

I have a 320x480 image which I`d like to fit the whole screen. This is the main.xml code

<ImageView   xmlns:android="http://schemas.android.com/apk/res/android"&gt;
        android:id='@+id/splash_medium'

        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 

        android:src="@drawable/wallpaper320x480"
         />

The screen shows the image but there is a considerable padding to the left and to the right, and a little bit to the top and to the bottom. I have tried setting android:padding to 0dip with no result.

Link to image, I can`t post images yet: screenshot

Any help would be appreciated.

A: 

check out http://stackoverflow.com/questions/991764/hiding-title-in-a-fullscreen-mode

steelbytes
Thanks for the answer, but I just fixed it by using a LinearLayout and setting the image as background. I don`t know if this is the proper way to it, tho.<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/wallpaper320x480"> </LinearLayout>
Maragues
the proper way would depend on what you wante to achieve and how you want it to act on androids with differnet screen sizes and different aspect ratios ... it depends.
steelbytes
+2  A: 

This was probably an issue with the size of your picture and lack of scaling. If your picture doesn't have enough pixels to fill the screen and you don't tell it to stretch the picture, then you'll have gaps at the sides. The fix is to use android:scaleType="fitXY". Note, this applies to when the image is set with android:src="..." rather than android:background="..." as backgrounds are set by default to stretch and fit to the View. (The purpose of having both is that it lets you do things like having a frame around an image, by setting a frame as the background and the main image as the source.)

Steve H