Here is a brief overview of what I put together:
<?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>
Adding an onClick element to an ActionBar, which: Adds the above layout as a child to your actions. The root group of the ViewGroup gives you the illusion of a fall.
Adding onClick to each of the buffers, which removes the view from the root ViewGroup, allows the drop-down menu to βexitβ when trying to move focus.
Style Information for Dropdown:
<item name="android:background">@drawable/menu_dropdown_panel_holo_light</item> <item name="android:dropDownSelector">@drawable/list_selector_background</item>
Layout for each list 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>
This does not give a perfect copy of the overflow functions, but it is pretty close. I am very interested if someone else knows a way to reproduce this functionality in a more integrated way!
source share