Code example for MenuItem

Methods: setShowAsAction

0
    public static final int SHOW_AS_ACTION_ALWAYS = 2;
    public static final int SHOW_AS_ACTION_WITH_TEXT = 4;
 
    private static class Api11OrLater { 
        public static void setShowAsAction(MenuItem item, int actionEnum) {
            item.setShowAsAction(actionEnum);
        } 
    } 
 
    public static void setShowAsAction(MenuItem item, int actionEnum) {
        if (AndroidCompat.SDK >= 11) { 
            Api11OrLater.setShowAsAction(item, actionEnum);
        } 
    } 
}