android autocompletetextview hint results hidden under keyboard

此生再无相见时 提交于 2019-11-29 16:04:40

问题


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

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));

回答1:


Use a ScrollView for the layout where your Autocomplete resides and Voila!




回答2:


Does your Activity adjustResize?

android:windowSoftInputMode="adjustPan|adjustResize"

reference: Move layouts up when soft keyboard is shown?




回答3:


you should look here : Creating an input method

Composing text before committing

If your IME does text prediction or requires multiple steps to compose a glyph or word, you can show the progress in the text field until the user commits the word, and then you can replace the partial composition with the completed text. You may give special treatment to the text by adding a "span" to it when you pass it to InputConnection#setComposingText().

this way, suggestions will apears on soft keyboard prediction like auto-correction. An other way of doing it will be a fullScreen IME... with ExctractEditText : See this link...

This is what i usualy have seen in other apps... i don't think the autocompletetextview can be inverted and appears on top of the view, but what's strange is that it usually shows on top of the keyboard not bellow...




回答4:


I had the same problem with this a little while ago. You Can try manipulating the z-index of the elements that are being hidden to force it to the top which would be your views in this case. Hope it works for you !




回答5:


Add an attribute in your AndroidManifest.xml

android:windowSoftInputMode="adjustPan|adjustResize"

Which will auto resize and adjust the soft keyboard.




回答6:


Use

 android:windowSoftInputMode="adjustPan|adjustResize"



回答7:


Take the autocomplete textviews in respective layouts then you see they opens their values in it only (ABOVE), set autocomplete texview (bottom) of each layouts, as per your question you required three child layouts.

it is really working



来源:https://stackoverflow.com/questions/3480529/android-autocompletetextview-hint-results-hidden-under-keyboard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!