TextView的自动完成建议列表是键盘背后 [英] Autocomplete TextView Suggestion List is behind Keyboard

查看:144
本文介绍了TextView的自动完成建议列表是键盘背后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经这么多累,同时寻找解决的办法,使在键盘前面的建议列表。

有键盘背后更多的建议。
我希望能够看到这些建议时,我触摸/通过引进键盘前面的列表中滚动此列表。
我检查了很多类似的问题,但没有任何希望有效地做到这一点。
在<一的建议href=\"http://stackoverflow.com/questions/14750786/scrolling-drop-down-menu-over-the-keyboard-in-autocompletetextview\">THIS问没有解决问题的所有设备。
我也看到<一个href=\"http://stackoverflow.com/questions/5927657/android-dropdown-auf-autocompletetextview-is-covered-by-the-keyboard\">THIS问但它并没有帮助解决问题。

有任何建议如何解决这个问题。


解决方案

 公共查看getView(最终诠释的立场,观点convertView,父母的ViewGroup){    LayoutInflater吹气=(LayoutInflater)的getContext()getSystemService(Context.LAYOUT_INFLATER_SERVICE)。
    ViewHolder持有人;
    如果(convertView == NULL){
        convertView = inflater.inflate(viewResourceId,父母,假);
        持有人=新ViewHolder();
        的init(convertView,持有人);
        convertView.setTag(保持器);
    }其他{
        支架=(ViewHolder)convertView.getTag();
    }    convertView.setOnTouchListener(新View.OnTouchListener(){        @覆盖
        公共布尔onTouch(视图V,MotionEvent事件){            如果(event.getAction()== MotionEvent.ACTION_DOWN){
                InputMethodManager IMM =(InputMethodManager)的getContext()
                        .getSystemService(
                                Context.INPUT_METHOD_SERVICE);
                imm.hideSoftInputFromWindow(
                        sea​​rchView.getWindowToken(),0);
            }            返回false;
        }
    });    的setView(位置,保持架);
    返回convertView;
}

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 to see these suggestion when I touch/scroll this list by bringing the list in front of the keyboard. I have checked many similar question but without any hope to efficiently do so. The suggestion made on THIS QUESTION does not solve the problem for all devices. I have also seen THIS QUESTION but it didn't help solve the problem.

Is there any suggestion how to solve this issue.

解决方案

public View getView(final int position, View convertView, ViewGroup parent) {

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

    convertView.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {

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

            return false;
        }
    });

    setView(position, holder);
    return convertView;
}

这篇关于TextView的自动完成建议列表是键盘背后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆