How to control ActionBar split programmatically?

后端 未结 5 679
陌清茗
陌清茗 2020-12-13 19:34

The android ActionBar may split into a top and bottom bars if activity\'s parameter \"uiOptions\" is set to \"splitActionBarWhenNarrow

5条回答
  •  暖寄归人
    2020-12-13 20:15

    Can you try to set getWindow().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW) in the Activity you want the ActionBar to show as split right before its onCreate(), then hide it using getActionBar.hide() and on the list action you are referring to make it pop-up back using getActionBar.show().

    I tried (not with the support libraries though) showing ActionBar in one Activity and Split in another using the above and was able to hide and show the split on button clicks. Hope this helps. Let me know in case it did or even didn't. Happy coding. :)

提交回复
热议问题