android autocompletetextview 提示结果隐藏在键盘下 [英] android autocompletetextview hint results hidden under keyboard

查看:46
本文介绍了android autocompletetextview 提示结果隐藏在键盘下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 3 个 autocompletetextview,其中我将它的适配器设置为 ArrayAdapter 和一个非常简单的 textview 布局.

I have 3 autocompletetextview's in which i set its adapter to be an ArrayAdapter<String> with a very simple textview layout.

autocompletextview 提示结果正在显示,但在屏幕键盘下(我可以看到其中的一部分).如何让结果显示在 autocompletetextview 上方而不是下方?

The autocompletextview hint results are showing, but are under the onscreen keyboard(i can see part of it). how can i make the results show above the autocompletetextview rather than below?

    airline = (AutoCompleteTextView)findViewById(R.id.airline);
    airline.setAdapter(new ArrayAdapter<String>(this, R.layout.autcomplete_dropdown, AIRLINES_AUTOCOMPLETE_ARRAY));

    departLocation = (AutoCompleteTextView)findViewById(R.id.departLocation);
    departLocation.setAdapter(new ArrayAdapter<String>(this, R.layout.autcomplete_dropdown, LOCATIONS_AUTOCOMPLETE_ARRAY));

    arriveLocation = (AutoCompleteTextView)findViewById(R.id.arriveLocation);
    arriveLocation.setAdapter(new ArrayAdapter<String>(this, R.layout.autcomplete_dropdown, LOCATIONS_AUTOCOMPLETE_ARRAY));

推荐答案

简单地限制下拉高度.

android:dropDownHeight="200dp"

结果不会被软键盘隐藏.

Then results don't hide by the soft keyboard.

否则就这样做

理论上说 android:windowSoftInputMode="adjustPan|adjustResize" 应该这样做,但由于某种原因,它没有,所以你必须以编程方式做同样的事情:

The theory says that android:windowSoftInputMode="adjustPan|adjustResize" should do this but for some reason, it doesn't, so you have to do the same programmatically:

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

这篇关于android autocompletetextview 提示结果隐藏在键盘下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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