Hi all,
I'm struggling with widget positioning using TSS. Whatever I do, the widget always ignores positioning set in the TSS file and remains centred. Coding it directly into the widget positions it but that's obviously not what I want to do for reusability
Have read through examples and it all appears correct
Anyway, here's my code
Widget code
widget.xml
<Alloy> <Label id="roundbutton" /> </Alloy>widget.tss
"#roundbutton": { height: 80, width: 80, backgroundColor: "#DC7A7E", borderColor: "#5F5F5F", borderRadius: 40, borderWidth: 1, color: "#FFFFFF", font: { fontFamily: "Aller", fontSize: 20 }, textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER, verticalAlign: Ti.UI.TEXT_VERTICAL_ALIGNMENT_CENTER }widget.js
var args = arguments[0] || {}; $.roundbutton.text = args.buttonText; var handlers = {}; exports.addEventListener = function(listenerName, listenerFunction) { switch (listenerName) { case "touchend": handlers.click = listenerFunction; break; }; }; $.roundbutton.addEventListener("touchstart", function(e) { $.roundbutton.borderColor = "#000000"; }); $.roundbutton.addEventListener("touchend", function(e) { $.roundbutton.borderColor = "##5F5F5F"; handlers.click(); });code in app
profile.xml ~~ <Widget src="roundbutton" id="button_save" buttonText="Save" />
profile.tss"#button_save":{
bottom: 8,
right: 8
}
~~~