我想在AutoCompleteTextView的下拉建議列表的右側添加PgUp/PgDn按鈕。我使用上述佈局創建了自己的彈出窗口(佈局xml如下所示)。任何人都可以讓我知道如何用我自己的彈出窗口替換AutoCompleteTextView的下拉列表視圖?如何爲AutoCompleteTextView創建我自己的下拉視圖?
這是我想它的樣子:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="10">
<ListView
android:id="@+id/listView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="9"
android:background="@drawable/frame">
</ListView>
<RelativeLayout android:id="@+id/pageUpDown" android:layout_weight="1" android:layout_width="0dp" android:layout_height="match_parent">
<ImageButton android:id="@+id/pageUp" android:src="@drawable/pct_up_icon" android:background="@null" android:layout_width="48dp" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:text="" android:layout_height="48dp"></ImageButton>
<ImageButton android:id="@+id/pageDown" android:src="@drawable/pct_down_icon" android:background="@null" android:layout_width="48dp" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:text="" android:layout_height="48dp"></ImageButton>
</RelativeLayout>
</LinearLayout>
謝謝沃歌斯。用於單個建議項目的completionHintView或顯示建議列表的彈出窗口?我需要替換彈出窗口。我試圖在android:completionHintView中使用佈局(在我原來的quation中),但得到了NullPointerException。 – j1999
NullPointerException是由其他人引起的。但下拉視圖仍然是一樣的。 – j1999
也許您應該嘗試創建自定義視圖組(EditText + PopupWindow)來模擬此行爲 – waqaslam