2013-03-19 81 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