|
@@ -362,7 +362,7 @@ public class RnnToolBar extends Toolbar {
|
362
|
362
|
for (int i = 0; i < size; i++) {
|
363
|
363
|
Button button = mNewButtons.get(i);
|
364
|
364
|
MenuItem item = menu.add(Menu.NONE, button.getItemId(), size - i - 1, button.title);
|
365
|
|
- item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
|
365
|
+ item.setShowAsAction(getMenuItemShowAction(button.showAsAction));
|
366
|
366
|
|
367
|
367
|
// Set button icon
|
368
|
368
|
if (button.hasIcon()) {
|
|
@@ -415,5 +415,18 @@ public class RnnToolBar extends Toolbar {
|
415
|
415
|
mToolbarWR.clear();
|
416
|
416
|
}
|
417
|
417
|
}
|
|
418
|
+
|
|
419
|
+ private int getMenuItemShowAction(String action) {
|
|
420
|
+ switch (action) {
|
|
421
|
+ case "never":
|
|
422
|
+ return MenuItem.SHOW_AS_ACTION_NEVER;
|
|
423
|
+ case "always":
|
|
424
|
+ return MenuItem.SHOW_AS_ACTION_ALWAYS;
|
|
425
|
+ case "withText":
|
|
426
|
+ return MenuItem.SHOW_AS_ACTION_WITH_TEXT;
|
|
427
|
+ default:
|
|
428
|
+ return MenuItem.SHOW_AS_ACTION_IF_ROOM;
|
|
429
|
+ }
|
|
430
|
+ }
|
418
|
431
|
}
|
419
|
432
|
}
|