[TIMOB-12993] android: button/view layout not consistent between android and iOS
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-06-20T21:28:26.000+0000 |
Affected Version/s | Release 3.1.0 |
Fix Version/s | 2013 Sprint 13 API, 2013 Sprint 13, Release 3.2.0 |
Components | Android |
Labels | android, exalture, i0S, module_button, parity, qe-testadded |
Reporter | Carter Lathrop |
Assignee | Sunila |
Created | 2013-03-05T19:52:53.000+0000 |
Updated | 2014-06-19T12:44:21.000+0000 |
Description
*Problem*
all buttons and the view I create are not at the same order on android. On iPhone it's all correct. I Attached the screenshots.
I create buttons and add them to scrollview the label I create a add usually to scrollview to, I tried it with a new subview, but without success.
I add the view at line #120 this is the section title in grey on iphone.png. this is a normal cycle, it have to be there to on android.
*Steps to Reproduce*
1. Copy and paste code into app.js
2. Run on android device or emulator
3. Run on iOS simulator
4. Notice the parity behavior
var _json = {
"menu" : [{
"name" : "Home",
"link" : "../id/home-de-mobile",
"linktarget" : "",
"type" : "html"
}, {
"name" : "Datenschutz",
"link" : "../id/86AE964D595138D2C12577CA003DF311?open&mobile=1",
"linktarget" : "",
"type" : "html"
}, {
"sectionheadline" : "www.wirtschaftsrat.de",
"entries" : [{
"name" : "Homepage",
"link" : "../id/home-de",
"linktarget" : "_blank",
"type" : "html"
}, {
"name" : "50 Jahre Wirtschaftsrat",
"link" : "../id/jubilaeum-de",
"linktarget" : "_blank",
"type" : "html"
}]
}]
};
var buttons = [];
var win = Ti.UI.createWindow();
var menuWindow = Ti.UI.createView({
top : 41,
layout : "vertical",
zIndex : 5000,
visible : true
});
var menuScrollView = Ti.UI.createScrollView({
backgroundColor : "#ccc",
scrollType : "vertical",
layout : "vertical",
zIndex : 100
});
for (x in _json.menu) {
if ( typeof (_json.menu[x].sectionheadline) == "undefined") {
buttons[x] = Ti.UI.createButton({
title : _json.menu[x].name,
link : _json.menu[x].link,
target : _json.menu[x].linktarget,
type : _json.menu[x].type,
width : "100%",
height : 50,
// top : x * 50,
left : 0,
top : 0,
color : "#222",
zIndex : 102
});
buttons[x].addEventListener("click", function(e) {
});
menuScrollView.add(buttons[x]);
} else if ( typeof (_json.menu[x].sectionheadline) != "undefined") {
var sectiontitle = Ti.UI.createLabel({
height : 50,
top : 0,
color : "#000",
text : _json.menu[x].sectionheadline
});
var sectionView = Ti.UI.createView({
height : 50
})
sectionView.add(sectiontitle);
menuScrollView.add(sectionView);
var y = x;
for (var z in _json.menu[x].entries) {
y++;
buttons[y] = Ti.UI.createButton({
title : _json.menu[x].entries[z].name,
link : _json.menu[x].entries[z].link,
target : _json.menu[x].entries[z].linktarget,
type : _json.menu[x].entries[z].type,
width : "100%",
height : 50,
top : 0,
left : 0,
color : "#222",
zIndex : 102
});
buttons[y].addEventListener("click", function(e) {
});
menuScrollView.add(buttons[y]);
}
}
}
menuWindow.add(menuScrollView);
win.add(menuWindow);
win.open();
Attachments
File | Date | Size |
---|---|---|
android.png | 2013-03-05T19:53:38.000+0000 | 281680 |
iphone.PNG | 2013-03-05T19:53:38.000+0000 | 111905 |
Hello Alexander, when trying to reproduce this issue and pasting the given code into an app.js, I was unable to produce anything. When creating a bug, please provide a concise, reproducible test case which is able to be pasted directly into an app.js and clearly shows the issue. This way I can more quickly determine the validity of the issue and pass along to engineering. Please edit the code above to show the error as well as provide clear steps to reproduce the issue. Thank you, Carter
Please reopen the bug, I change the code example.
Thank you for the edit Alexander, will review and get back to you
Confirmed parity behavior, moved to Ti-Mobile
3.2.0.v20130522185622 still the same problem.
Since controls doesn't overlap in vertical and horizontal layouts, we shouldn't be sorting controls based on zOrder, the original order should be preserved. https://github.com/appcelerator/titanium_mobile/pull/4363
Verified the fix. We now see parity between android & IOS regarding this issue. Thus closing. Environment: Appcel Studio : 3.2.0.201310230601 Ti SDK : 3.2.0.v20131022171645 Mac OSX : 10.8.5 CLI - 3.2.0 with hash 72f7426b4ee6c2d2883c666d5b7e03906a16012f Android emulator : 4.1.2 IOS simulator : iphone retina(3.5 inch)