これが私が一緒に石畳にしたもののまとめです:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dropdownContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/leftBuffer"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<LinearLayout
android:layout_width="150dp"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/actionbarDropdown"
style="@style/Widget.ActionBarDropDown"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cacheColorHint="@android:color/transparent"
android:entries="@array/sortOptions" />
<LinearLayout
android:id="@+id/bottomBuffer"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:id="@+id/rightBuffer"
android:layout_width="118px"
android:layout_height="match_parent" />
</LinearLayout>
onClickをActionBarアイテムに追加すると、上記のレイアウトが子としてアクティビティルートViewGroupに追加され、ドロップダウンのように見えます。
ルートViewGroupからビューを削除するonClickを各バッファーに追加すると、フォーカスを移動しようとしたときにドロップダウンを「終了」することができます。
ドロップダウンのスタイリング情報は次のとおりです。
<item name="android:background">@drawable/menu_dropdown_panel_holo_light</item>
<item name="android:dropDownSelector">@drawable/list_selector_background</item>
各リストアイテムのレイアウトは次のとおりです。
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="48dp"
android:textSize="17sp"
android:gravity="right|center_vertical"
style="?android:attr/dropDownItemStyle"
android:ellipsize="marquee"
android:id="@android:id/text1">
</TextView>
これは、オーバーフロードロップダウンの機能の完全なコピーを提供しませんが、かなり近いです。この機能をより統合された方法で再現する方法を他の誰かが知っているなら、私は非常に興味があります!