Actual Result
Setting the "left" or "right" property of a Ti.UI.ActivityIndicator yields incorrect positioning. The ActivityIndicator seems to be centering on a horizontal coordinate that is relative to the center of the view that the ActivityIndicator is added to.
Examples:
* ActivityIndicator with left=0 or right=0 will be centered within its view.
* ActivityIndicator with left=50 will have its center positioned 50px to the right of the center of its view.
* ActivityIndicator with right=-50 will have its center positioned 50px to the right of the center of its view.
* ActivityIndicator with right=50 will have its center positioned 50px to the left of the center of its view.
Expected result
When the "left" or "right" property is supplied, the Ti.UI.ActivityIndicator should be positioned within the view it is added to accordingly, just like any other component would be (button, image, label, etc).
Test case
var win1 = Ti.UI.createWindow({
backgroundColor:'#fff'
});
var label1 = Ti.UI.createLabel({
backgroundColor:'green',
color:'white',
text:'Spinner should be on top of the X',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
top:40,
height:40,
width:'auto'
});
win1.add(label1);
var view1 = Ti.UI.createView({
backgroundColor:'yellow',
height:30,
top:100,
width:100
});
win1.add(view1);
var spin1=Ti.UI.createActivityIndicator({
//right:25,
left:25,
style:Ti.UI.iPhone.ActivityIndicatorStyle.DARK
});
view1.add(spin1);
var marker1=Ti.UI.createLabel({
//right:25,
left:25,
height:'auto',
width:'auto',
text:'X'
});
view1.add(marker1);
win1.open();
spin1.show();
The code above should place the spinner right on top of the X.
Workaround
Explicitly set the activityIndicator width and height properties to
'auto'
Thanks for this ticket, Shawn. Would you mind completing the environment field, so that I may move it to the main project? Cheers
I will close this for now. Please reopen the ticket once it is complete, and I will move it to the main project.
Paul, I added "iOS 5.0, OSX 10.7.2" and my Ti Studio version to the environment section. Is that what you needed? I cannot reopen the ticket myself (or I don't know how to). Please reopen and move to main project. Thanks.
Thanks for the email, Shawn. I will look at this in detail tomorrow.
Just to note, I've accepted this ticket.
Tentatively linking to TIMOB-7643. The behavior on activity indicator was because it was doing fill, not size, sizing by default. The new composite layout behavior may fix this.
Vishal verified that TIMOB-7643 will fix this.
Mega-pull #1523 fixes this.
Closing bug. Verified fix on: SDK build: 2.0.0.v20120315091738 Titanium Studio, build: 2.0.0.201203142055 xcode: 4.2 Device: iphone 4s (5.0.1)
Reopening/closing to add/remove labels