0

I have a layout in which I have autoComplete edit text with some suggestions. The image below is its normal behaviour until keyboard slides in.

enter image description here

after the keyboard comes the dropdown goes above the field which hides my TO: field. As shown below. enter image description here

What should I do to get the dropdown below even when the keyboard slides up. I want the result to be like this.

enter image description here

Thanks...

Hardik4560
  • 3,202
  • 1
  • 20
  • 31
  • duplicate of http://stackoverflow.com/questions/11554766/autocompletetextview-suggestion-list-goes-up#comment15928713_11554766 – nandeesh Aug 16 '12 at 15:03

1 Answers1

0

I resolved this by hiding the upper layout when key board is shown and focus is on this edit text. As soon as the keyboard is slided_out the upper layout is visible again which bring back the original screen. For detecting the keyboard slide_in/slide_out i used something like this.

final View activityRootView = findViewById(R.id.activityRoot);
    activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(
            new OnGlobalLayoutListener() {
                @Override
                public void onGlobalLayout() {
                    int heightDiff = activityRootView.getRootView()
                            .getHeight() - activityRootView.getHeight();
                    if (heightDiff > 100) { // if more than 100 pixels, its
                                            // probably a keyboard...
                        if (searchText.isFocused()) {
                            //keyboard is shown
                        }
                    } else {
                        if (searchText.isFocused()) {
                            //Keyboard is hidden.
                        }
                    }
                }
            });
Hardik4560
  • 3,202
  • 1
  • 20
  • 31