Skip to content Skip to sidebar Skip to footer

Autocomplete Textview Suggestion List Is Behind Keyboard

I have been so much tired while searching for a solution to bring the suggestion list in front of the keyboard. There are more suggestions behind the keyboard. I want to be able t

Solution 1:

This is due to a layout problem. Basically your keyboard has the focus because the user is writting, but you want to show the dropdown list. But if you see the dropdown list, you won't see the keyboard and the user will have to focus the EditText each time they want to keep writing. So basically the behavior you're seeing is the correct IMO.

You have 2 options here:

1) Change your layout so the Help Center shows from the very top of the screen and has a sufficient height to show all its suggestions.

2) Limit the dropdown items to show. Since there's no native way of achieving this, as there's no maximumSuggestions option, you can get the height of one of the rows and multiply it X times (being X the number of rows to show) and use setDropDownHeight() to set its height. More info on this here.

Solution 2:

public View getView(finalint position, View convertView, ViewGroup parent) {

    LayoutInflaterinflater= (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    ViewHolder holder;
    if (convertView == null) {
        convertView = inflater.inflate(viewResourceId, parent, false);
        holder = newViewHolder();
        init(convertView, holder);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }

    convertView.setOnTouchListener(newView.OnTouchListener() {

        @OverridepublicbooleanonTouch(View v, MotionEvent event) {

            if (event.getAction() == MotionEvent.ACTION_DOWN) {
                InputMethodManagerimm= (InputMethodManager) getContext()
                        .getSystemService(
                                Context.INPUT_METHOD_SERVICE);
                imm.hideSoftInputFromWindow(
                        searchView.getWindowToken(), 0);
            }

            returnfalse;
        }
    });

    setView(position, holder);
    return convertView;
}

Post a Comment for "Autocomplete Textview Suggestion List Is Behind Keyboard"