Skip to content

Instantly share code, notes, and snippets.

@asiviero
Last active December 27, 2015 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asiviero/7323237 to your computer and use it in GitHub Desktop.
Save asiviero/7323237 to your computer and use it in GitHub Desktop.
Using a padding-like style to position text in a button. Add eventListeners to View object instead of Button.
$.button_view.addEventListener('click', function(e){
alert("Button Clicked");
});
"#button_view" : {
width : "100dp",
height : "100dp",
}
"#button" : {
width : Ti.UI.FILL,
height : Ti.UI.FILL,
}
"#button_label" : {
textAlign : 'center',
left : "10dp",
width : Ti.UI.FILL,
height : Ti.UI.FILL,
}
<Alloy>
<Window>
<View id="button_view">
<Button id="button" />
<Label id="button_label">Label</Label>
</View>
</Window>
</Alloy>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment