문제

Is it possible to create a click event using the status bar icon enter image description here

도움이 되었습니까?

해결책

You need to add a callback to the onHomeIconItemSelected property. Say you have a Tabgroup with a "tabGroup" id, it would be something like:

$.tabGroup.addEventListener('open', function(e) {
    var activity = $.tabGroup.activity;
    // Avoid older APIs executing this code
    if( Ti.Platform.Android.API_LEVEL >= 11 ) {
        activity.actionBar.onHomeIconItemSelected = function() {
            alert("Home icon clicked!");
        };  
    }
}

For a more complete and detailed explanation, you could refer to https://github.com/websterj/Alloy2TabbedAndroidUI which is a good demonstration of an app using the Action Bar in Titanium.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top