Dynamically position the right corner arrow of an ActionBar Spinner depending on the length of the displayed title

In the Google+ application, the position of the right arrow of the corner is ActionBar Spinneradapted to the length of the current line. For example, the Spinner length seems shorter when Family is selected versus when Dating is selected.

What do I need to do to get the right angle arrow for a dynamic position based on the length of the header? I assume there is an attribute that I can set in styles.xml that will do this for me.

Here are my styles.xml:

<style name="MyStyle" parent="android:style/Theme.Holo">
    <item name="android:actionDropDownStyle">@style/MyDropDownNav</item>
</style>

<style name="MyDropDownNav" parent="android:style/Widget.Holo.Spinner">
    <item name="android:AttributeHere">AttributeValue</item>
</style>

Here is the code that I have in my MainActivity.java:

ActionBar actionBar = getActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

// Specify a SpinnerAdapter to populate the dropdown list.
SpinnerAdapter dataAdapter = new ArrayAdapter<String>(
        actionBar.getThemedContext(),
        android.R.layout.simple_list_item_1, android.R.id.text1,
        new String[] { "AAAAAAAAAAAAAAA", "BB" });

// Set up the dropdown list navigation in the action bar.
actionBar.setListNavigationCallbacks(dataAdapter, this);

Unlike Google+, the position of the right-hand corner arrow is always fixed. Therefore, if I select from "AAAAAAAAAAAAAAAA" in "BB" from the drop-down list, the arrow does not move at all.

+5
1

, android pure Calendar, getView() Calendar, Spinner . Spinner ActionBar . Calendar .

0

All Articles