Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamically position right corner arrow of the ActionBar Spinner based on length of displayed title
    text
    copied!<p>In the Google+ App, the position of the right corner arrow of the <code>ActionBar</code> <code>Spinner</code> adapts to the length of the current string showing. For example, the Spinner's length seems shorter when <em>Family</em> is picked versus when <em>Acquaintances</em> is picked.</p> <p>What do I have to do to get the right corner arrow to position dynamically based on the title's length? My guess is that there's an attribute I can set in <em>styles.xml</em> that will do that for me.</p> <p>Here's my styles.xml:</p> <pre><code>&lt;style name="MyStyle" parent="android:style/Theme.Holo"&gt; &lt;item name="android:actionDropDownStyle"&gt;@style/MyDropDownNav&lt;/item&gt; &lt;/style&gt; &lt;style name="MyDropDownNav" parent="android:style/Widget.Holo.Spinner"&gt; &lt;item name="android:AttributeHere"&gt;AttributeValue&lt;/item&gt; &lt;/style&gt; </code></pre> <p>Here's the code I have in my MainActivity.java:</p> <pre><code>ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); // Specify a SpinnerAdapter to populate the dropdown list. SpinnerAdapter dataAdapter = new ArrayAdapter&lt;String&gt;( 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); </code></pre> <p>Unlike in Google+, the position of my right corner arrow is always fixed. So if I choose from "AAAAAAAAAAAAAAA" to "BB" from the dropdown, the arrow doesn't move at all.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload