Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Action Bar (Sherlock Action Bar) - Position the drop-down spinner all the way to the right

Is there any way to change the position of the drop-down spinner in the action bar?

I've found this style for the spinner-drop down:

    <style name="Sherlock.__Widget.Holo.Spinner" parent="Widget">
    <item name="android:dropDownSelector">@drawable/abs__list_selector_holo_dark</item>
    <item name="android:popupBackground">@drawable/abs__menu_dropdown_panel_holo_dark</item>
    <item name="android:dropDownVerticalOffset">0dip</item>
    <item name="android:dropDownHorizontalOffset">0dip</item>
    <item name="android:dropDownWidth">wrap_content</item>
    <item name="android:gravity">left|center_vertical</item>
    <item name="android:spinnerMode">dropdown</item>
    <item name="android:clickable">true</item>
</style>

...but how do I make this spinner go all the way to the right of the action bar? Right now it looks like this....

Example Activity

I'd like for the spinner to sit flush against the right side of the action bar.

like image 503
dell116 Avatar asked Oct 08 '22 16:10

dell116


1 Answers

No.

The only way to do this would be to use a custom navigation where you give it your own Spinner. Then you can set the gravity to the right on the ActionBar.LayoutParams. This will move the custom view to the right of the screen (but it will still remain to the left of the action items).

like image 168
Jake Wharton Avatar answered Oct 12 '22 11:10

Jake Wharton