android - AutoCompleteTextView dropDown 高度不正确

标签 android autocompletetextview

我在下拉项中使用自定义 View 。 我有两个项目:第一个项目包含一行,第二个项目包含两行。但 dropDown 高度等于两行,而不是三行,并添加了 ScrollView (参见屏幕截图)。 同样,如果我有三个项目,它们具有不同的行数,则下拉高度等于三行。

enter image description here

enter image description here

如何正确设置下拉菜单的高度?

最佳答案

您可以使用AutoCompleteTextViewsetDropDownHeight()方法,例如:

int sumHeight = textVeiw1.getHeight()+textView2.getHeight();
autoEditText.setDropDownHeight(sumHeight);

关于android - AutoCompleteTextView dropDown 高度不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27641554/

相关文章:

android - 带有建议的文本框

android - onLongClick 时,AutoCompleteTextView 在剪切/复制/粘贴菜单上出现奇怪的裁剪问题

java - Handler::removeMessages 的 RxJava 模拟

android - 应用关闭时如何停止MediaPlayer的声音?

android - 如何在 Android 中创建 Socket 连接?

具有可绘制 int 数组的 Android ListView 可提高性能

android - Facebook 评论 api phonegap

Android:ExternalSystemException:字符串索引超出范围:-130 构建版本

java - AutoCompleteTextView 自定义 ArrayAdapter 显示整个 ArrayList 而不是单独的字符串

android - AutoCompleteTextView 为下拉列表创建边距