android – 对话框片段中软键盘后面的Autocompletetextview下拉列表

android – 对话框片段中软键盘后面的Autocompletetextview下拉列表,第1张

概述我的应用程序中有一个对话框片段,其中包含autocompletetextview,但下拉列表不是与软键盘的顶部对齐,而是放在后面,不提供对某些项目的访问权限. 这是布局: <?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 我的应用程序中有一个对话框片段,其中包含autocompletetextvIEw,但下拉列表不是与软键盘的顶部对齐,而是放在后面,不提供对某些项目的访问权限.

这是布局:

<?xml version="1.0" enCoding="utf-8"?><linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:layout_wIDth="match_parent"    androID:layout_height="wrap_content"    androID:gravity="center"    androID:padding="10dp"    androID:orIEntation="horizontal"    androID:windowsoftinputMode="adjustPan|adjustResize">    <androID.Widget.autoCompleteTextVIEw        androID:layout_wIDth="0dp"        androID:layout_height="wrap_content"        androID:ID="@+ID/customDialogAtocompleteTextvIEw"        androID:layout_weight=".7"        androID:layout_gravity="top" />    <linearLayout        androID:orIEntation="vertical"        androID:layout_wIDth="0dp"        androID:layout_height="wrap_content"        androID:layout_weight=".3">        <button            androID:ID="@+ID/customDialogBtOk"            androID:layout_wIDth="match_parent"            androID:layout_height="wrap_content"            androID:text="Aceptar"/>        <button            androID:ID="@+ID/customDialogBtSearch"            androID:layout_wIDth="match_parent"            androID:layout_height="wrap_content"            androID:text="Buscar"/>        <button            androID:ID="@+ID/customDialogBtMore"            androID:layout_wIDth="match_parent"            androID:layout_height="wrap_content"            androID:text="Mas"/>    </linearLayout></linearLayout>

那我怎么能让它与键盘对齐?

解决方法 理论上说androID:windowsoftinputMode =“adjustPan | adjustResize”应该这样做,但由于某些原因它没有,所以你必须以编程方式做同样的事情:
getDialog().getwindow().setSoftinputMode(WindowManager.LayoutParams.soFT_input_ADJUST_RESIZE);

Aaaaa和魔法发生了

总结

以上是内存溢出为你收集整理的android – 对话框片段中软键盘后面的Autocompletetextview下拉列表全部内容,希望文章能够帮你解决android – 对话框片段中软键盘后面的Autocompletetextview下拉列表所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1134035.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存