Created
July 20, 2018 09:06
-
-
Save Topener/8ad332754fea6744b11b73f3639ea586 to your computer and use it in GitHub Desktop.
Custom actionbar menu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function showMenu(){ | |
// posbile position to implement a show animation | |
$.menu.visible = true; | |
$.menu.height = Ti.UI.SIZE; | |
} | |
function hideMenu(){ | |
// posbile position to implement a hiding animation | |
$.menu.visible = false; | |
$.menu.height = 0; | |
} | |
function handleMenuItem(e){ | |
console.log(e.source.action); | |
hideMenu(); | |
} | |
$.index.open(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Window": { | |
theme: "Theme.AppCompat.Translucent.NoTitleBar", | |
backgroundColor: "#ffffff" | |
} | |
"#actionbar": { | |
backgroundColor: "#575757", | |
height: 60, | |
top: 0 | |
} | |
"#menuIcon": { | |
image: '/images/menu.png', | |
width: 30, | |
height: Ti.UI.SIZE, | |
right: 15 | |
} | |
"#menu": { | |
height: 0, | |
visible: false, | |
width: 170, | |
backgroundColor: "#575757", | |
right: 15, | |
top: 20, | |
zIndex: 99, | |
borderWidth: 1, | |
borderColor: "#232323", | |
layout: 'vertical' | |
} | |
".menuLabel": { | |
color: "#ffffff", | |
left: 10, | |
right: 10, | |
textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT, | |
font: { | |
fontSize: 20 | |
}, | |
top: 20 | |
} | |
"#firstLabel": { | |
text: "Menu Item", | |
} | |
"#secondLabel": { | |
text: "Do something", | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Alloy> | |
<Window class="container"> | |
<View id="menu"> | |
<Label id="firstLabel" class="menuLabel" action="first" onClick="handleMenuItem" /> | |
<Label id="secondLabel" class="menuLabel" action="something" onClick="handleMenuItem" /> | |
<View height="20" /> | |
</View> | |
<View id="actionbar"> | |
<ImageView id="menuIcon" onClick="showMenu" /> | |
</View> | |
</Window> | |
</Alloy> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment