Quantcast
Viewing all articles
Browse latest Browse all 8068

Adding custom view as actionView in action bar

Hi,

I have an action view that I want to add into action bar. I have create a custom view that I want to replace as action view. But, even though the event listener works, but I can't see the image for the action view.

var testView = Ti.UI.createButton({
    backgroundImage:"../category/images_category/Cart-Wishlist.png"
});
 
tabGroup.getActivity().onCreateOptionsMenu = function(e) { 
            var menu = e.menu; 
            var menuItem = menu.add({ 
                //icon : "../category/images_category/Cart-Wishlist.png", 
                showAsAction : Ti.Android.SHOW_AS_ACTION_ALWAYS,
                actionView:testView,
                //title:'Cart'
            }); 
            menuItem.addEventListener("click", function(e) { 
                alert("Action Item Clicked!"); 
            }); 
        };
Is there any specific size that the image has to be or anything wrong with my code? I am building for android using 3.1.3 with tool-api 14 and targetsdkversion is 11.

Viewing all articles
Browse latest Browse all 8068

Trending Articles