Android Question How to force an EditText to loose the focus ?

Discussion in 'Android Questions' started by marcick, Apr 25, 2015.

  1. marcick

    marcick Well-Known Member Licensed User

    The title should explain everything...
  2. fixit30

    fixit30 Active Member Licensed User

  3. LucaMs

    LucaMs Expert Licensed User

    Ah, bene, sei italiano, non snobbare il forum italiano grrrrrrr :)

    Spostando il focus su un'altra EditText, ad esempio, magari non visibile.

    By setting the focus on another EditText, maybe invisible.
  4. marcick

    marcick Well-Known Member Licensed User

    Yes, I already tried that trick, but if the control is invisible it does not accept the focus.
    Also if I set it visible and move it off-screen, let's say .left=10000 it does not accept focus.
    (ciao Luca, non snobbo nessuno ma qua siamo in tanti !)
  5. fixit30

    fixit30 Active Member Licensed User

    It does look like if the EditText is not Visible then it will not accept focus, however with my Sample attached it DOES work if the EditText is off the screen. If you look at the Layout file in the designer and set zoom to 50% you will see the second EditText.

    Attached Files:

    Rob Rendle likes this.
  6. mangojack

    mangojack Well-Known Member Licensed User

    I have used this workaround a few times .. and agree with @fixit30 that it works if the ET is off screen.
    In the Designer EditText is set to ..
    Visible = True
    Enabled = 
    and hidden beneath another view (Send to Back in the Designer)
    When needed I call
    Mahares likes this.
  7. marcick

    marcick Well-Known Member Licensed User

    Hi all,
    I don't know why fixit30 sample was working and the same trick on my project not. I have removed my EdtTexts and added again, now it behaves as desired.
    Thanks everybody
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice