2013-03-19 29 views
0

我有一个AutoCompleteTextView朝向我的屏幕边...非常简单的XML。Android AutoCompleteTextView建议出现半屏

<AutoCompleteTextView 
      android:id="@+id/location" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:hint="Location" 
      /> 

下面是我使用的适配器。

locationsAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, this.locations); 

不幸的是,建议出现在屏幕上的一半,所以例如“Kitchen Table”显示为“Kitch”。

此外,当我将按钮进一步向左移动以使其保持在屏幕上时,下拉的宽度被截断为按钮的宽度,该宽度小于许多文本选项。

有什么建议吗?

我使用的是HTC Sensation XL,不知道这是否与设备相关的行为。

相关问题:AutoCompleteTextView drop-down appears above the edit field instead of beneath

+0

我想明显的答案是移动按钮,我已经做了,但在我看来,UI应该可以在屏幕上显示下拉菜单。 – Alex 2013-03-19 10:41:54

回答

1

对不起球员...我应该刚刚抬头的文档!

android:dropDownWidth="200dp" 
android:dropDownHorizontalOffset="-30dp" 

可能有更好的方法来做到这一点...请让我知道如果你有一个最喜欢的。

+0

为我工作,谢谢 – 2016-06-22 01:41:19

相关问题