Keyboard layout hiding android action bar?
Asked Answered
F

1

15

In my Android application running in a XOOM device, when I click in an Edittext the keyboard opens and hides the Actionbar. I don't want this to happen, how can I solve this? This is done by the Google Contacts app for the tablet for example.

EDIT: I have several edittexts in which the user needs fo fill. At first, when the user clicked on one edittext on the bottom, the keyboard showed up and hide the edittext in which the user was typing, so he couldn't see what he was typing. I found it really bad, and to solve it I just added to the manifest: android:windowSoftInputMode="stateVisible|adjustPan" But after that, now the screen adjust itselfs and hides the action bar.

The Google Contacts app does the same, but it magically doesn't hide the Action bar. How do they do it?

Freelance answered 22/11, 2011 at 14:34 Comment(3)
did you try to add android:imeOptions="flagNoExtractUi" (or EditText.setImeOptions(...)) to this EditTextBaryton
@Baryton it didn't solve the issue. I just updated the question.Freelance
I have the same issue. I've tried adding "adjustResize" but it does not help.Deron
S
32

Use adjustResize instead of adjustPan. The framework will always try to keep the focused element on-screen by scrolling any parent views if necessary.

If your EditText field is not nested in some sort of scrolling container such as a ScrollView then your layout may be too tall to completely display when the keyboard resizes your activity. Try wrapping your form's layout in a ScrollView. This will also allow your app's content to scroll if it is running on a smaller screen device where it may have similar issues.

Smalt answered 26/11, 2011 at 19:21 Comment(6)
But I dont't want to resize it. It's no problem for me to hide some content. The only content thats needs to be on the screen is the selected edittext and the actionbar. Just like the Google Contacts does. How do they do it?Freelance
They do it by using adjustResize. :) If you are having trouble with the keyboard obscuring your content (and you will on some devices with different screen sizes or taller keyboards) then you really do want the resizing behavior. This lets you use scrolling containers to keep the activity content accessible with the keyboard open.Smalt
Thank you. I needed both adjustResize and a scrollview together.Freelance
I have this problem also but the difference is, i have a list above my edittext and can't use a scrolling container. If I use adjustResize when the edittext is focused it appears above the list and the last items from the list get obscured (list is not pushed up). If I don't use adjustResize on the other hand, when the edittext is focused it pushes everything up but the acionbar is hidden and also I cannot scroll to the top of the list. Can someone share a solution for this?Zweig
@Zweig how did you solve your problem? i am running into the same now.Spearwort
I am also looking solution to the exact same problem. Have spend hours to try everything, still no luck.Goddord

© 2022 - 2024 — McMap. All rights reserved.