How to make my app full screen


Last Updated:

  1. Kailas

    Kailas Member This Topic's Starter

    Joined:
    Aug 25, 2010
    Messages:
    19
    Likes Received:
    0
    Hi everyone, I've just started learning android development and while I haven't run into any major road blocks yet, this is really bugging me.

    When I run my app it only takes up part of the emulator's screen.

    I've attached a screen shot of my app which currently contains 2 buttons, the second one has a width of 480px (which is the width of the emulator screen) and a height of fill_parent (which should make it take up the entire screen vertically as well).

    I has to scale down and rotate the screen shot when I uploaded it but it still shows what I mean. Does anyone know why it wouldn't be full screen be default?

    Screen Shot.PNG
     

    Advertisement
  2. meskiukas

    meskiukas Member

    Joined:
    Aug 20, 2010
    Messages:
    13
    Likes Received:
    1
    Can you post your layout XML file?

    In general, though, you should set the items you want to take up the whole screen to a pixel width. Always use fill_parent, since that will ensure it works on all types of devices.
     
  3. Kailas

    Kailas Member This Topic's Starter

    Joined:
    Aug 25, 2010
    Messages:
    19
    Likes Received:
    0
    Here's my main layout xml file

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:minSdkVersion="7"
    android:eek:rientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <Button
    android:id="@+id/buttonNewGame"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="New Game"
    />
    <Button
    android:id="@+id/buttonQuit"
    android:layout_width="480px"
    android:layout_height="fill_parent"
    android:text="Quit"
    />
    </LinearLayout>

    The 480px width was a test to make sure that the emulator was the right resolution.

    fill_parent was supposed to make the quit button take up the entire screen.

    Edit - heh, it automatically put a smiley in.
     
  4. Kailas

    Kailas Member This Topic's Starter

    Joined:
    Aug 25, 2010
    Messages:
    19
    Likes Received:
    0
    I'm pretty sure when I woke up today and started coding again, my app was taking up the entire emulator screen like it should (I was testing a background image and I would have noticed if it wasn't working properly).

    When I added a new activity to my AndroidManifest.xml, it went back to how it was yesterday. When I undid the change ... it stayed the same.

    Here's another screen shot. It should be showing a grid of gray triangles 12 across and 20 down but it only shows 8 across and 12 down, while the background image is scaled down and stretched to fit into the small area that isn't even the same aspect ratio.

    I rotated the image so that it would fit into the size requirements for this forum.
     

    Attached Files:

Share This Page

Loading...