Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2840] Android: Inconsistent vertical layout mechanism between "View" and "ScrollView" components

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2011-12-21T21:26:16.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterIvan Skugor
AssigneePaul Dowsett
Created2011-11-16T00:39:59.000+0000
Updated2016-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

FileDateSize
screenshot_459.png2011-12-21T21:45:31.000+000023857

Comments

  1. Paul Dowsett 2011-12-21

    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();
       
  2. Ivan Skugor 2011-12-22

    I can confirm that this issue is fixed. Thanks again.

JSON Source