1. Download our Official Android App: Forums for Android!

Apps Application scroll to first edit field on start up.

Discussion in 'Android Development' started by Droid_Coder, Oct 5, 2011.

  1. Droid_Coder

    Droid_Coder Newbie
    Thread Starter
    Rank:
    None
    Points:
    35
    Posts:
    10
    Joined:
    Oct 5, 2011

    Oct 5, 2011
    10
    0
    35
    Software Developer
    Co. Mayo, Ireland
    Hi,

    I'm debugging my first Android app and when running in the emulator it seems fine. The main view appears and no edit fields have focus. I see the full screen including the introduction text at the top.

    When I start this on my Vodafone 858 Smart phone, the view scrolls down to the first edit field (which is a phone number field) and also pops up the number pad. I have removed the 'focus' tags from my mains.xml, so I do not see why it's scrolling to the first edit field.

    Android SDK 2.2 (8)

    Any suggestions on what I can modify to prevent this?

    Cheers...
     

    Advertisement

  2. Droid_Coder

    Droid_Coder Newbie
    Thread Starter
    Rank:
    None
    Points:
    35
    Posts:
    10
    Joined:
    Oct 5, 2011

    Oct 5, 2011
    10
    0
    35
    Software Developer
    Co. Mayo, Ireland
    I sorted this out. I found this little trick after many google searchs. I added the following lines to the beginning of my main LinearLayout section, just prior to the TextView I set up for my title.

    <LinearLayout android:focusable="true" android:focusableInTouchMode="true" android:layout_width="0px" android:layout_height="0px"/><requestFocus></requestFocus>
     

Share This Page

Loading...