[AC-2840] Android: Inconsistent vertical layout mechanism between "View" and "ScrollView" components
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Closed |
| Resolution | Cannot Reproduce |
| Resolution Date | 2011-12-21T21:26:16.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Titanium SDK & CLI |
| Labels | n/a |
| Reporter | Ivan Skugor |
| Assignee | Paul Dowsett |
| Created | 2011-11-16T00:39:59.000+0000 |
| Updated | 2016-03-08T07:47:46.000+0000 |
Description
Run this code to see the difference:
var win = Ti.UI.createWindow({
backgroundColor: '#000',
layout: 'vertical'
});
var view1 = Ti.UI.createScrollView({
layout: 'vertical',
contentHeight: '50%',
height: '50%',
backgroundColor: '#00f'
});
var view2 = Ti.UI.createView({
layout: 'vertical',
height: '50%',
backgroundColor: '#0f0'
});
var label1 = Ti.UI.createLabel({
text: 'ScrollView',
right: 20,
top: 10,
width: 200
});
var button1 = Ti.UI.createButton({
top: '50%',
right: 0,
width: 200,
title: 'Button 1'
});
var label2 = Ti.UI.createLabel({
text: 'View',
top: 10,
right: 20,
width: 200
});
var button2 = Ti.UI.createButton({
top: '50%',
right: 0,
width: 200,
title: 'Button 2'
});
view1.add(label1);
view1.add(button1);
view2.add(label2);
view2.add(button2);
win.add(view1);
win.add(view2);
win.open();
"View"'s behavior is, IMHO, the right one and "ScrollView" should behave same way.
Attachments
| File | Date | Size |
|---|---|---|
| screenshot_459.png | 2011-12-21T21:45:31.000+0000 | 23857 |
Using Titanium 1.8.0.1 (2011/12/17 19:53 c903964) + Android APIs 2.2 and the following code produces the correct behavior and thus the screenshot attached.
var win = Ti.UI.createWindow({ backgroundColor: '#000', layout: 'vertical' }); var scrollView1 = Ti.UI.createScrollView({ layout: 'vertical', height: '50%', backgroundColor: '#00f' }); var view2 = Ti.UI.createView({ layout: 'vertical', height: '50%', backgroundColor: '#0f0' }); var label1 = Ti.UI.createLabel({ text: 'ScrollView', right: 20, top: 10, width: 200 }); var button1 = Ti.UI.createButton({ top: '50%', right: 0, width: 200, title: 'Button 1' }); var label2 = Ti.UI.createLabel({ text: 'View', top: 10, right: 20, width: 200 }); var button2 = Ti.UI.createButton({ top: '50%', right: 0, width: 200, title: 'Button 2' }); scrollView1.add(label1); scrollView1.add(button1); view2.add(label2); view2.add(button2); win.add(scrollView1); win.add(view2); win.open();I can confirm that this issue is fixed. Thanks again.