Set android:showAsAction=“ifRoom|withText” programmatically

前端 未结 3 1457
栀梦
栀梦 2020-12-18 19:19

Is it possible to set the flags as suggested here android:showAsAction=\"ifRoom|withText\" programmatically?

3条回答
  •  天涯浪人
    2020-12-18 19:42

    For each MenuItem, do the following:

    myMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
    

提交回复
热议问题