How does splitActionBarWhenNarrow exactly work in

2019-04-12 06:35发布

问题:

The Android docs describe splitActionBarWhenNarrow like this: "Add a bar at the bottom of the screen to display action items in the ActionBar, when constrained for horizontal space (such as when in portrait mode on a handset)."

But how is "constrained for horizontal space" defined? There seems to be no way to define when this split occurs.

回答1:

I'm using ActionBarSherlock and the action bar is split when the screen width is below 480dp. This behaviour is defined by the two following resource files :

res/values-w480dp/abs_bools.xml

<resources>
    <bool name="abs__action_bar_embed_tabs">true</bool>
    <bool name="abs__split_action_bar_is_narrow">false</bool>
</resources>

res/values/abs_bools.xml

<resources>
    <bool name="abs__action_bar_embed_tabs">false</bool>
    <bool name="abs__split_action_bar_is_narrow">true</bool>
</resources>

I have not checked if this is the same behaviour as in ICS code but I'm pretty sure it is.