Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2897] Android: children in horizontal layout expand to fill parent height even if height specified

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T02:00:23.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.6.0 M06
ComponentsAndroid
Labelsandroid, defect, enterprise, release-1.6.0, reported-1.6.0, rplist
ReporterBill Dawson
AssigneeBill Dawson
Created2011-04-15T03:32:21.000+0000
Updated2011-04-17T02:00:23.000+0000

Description

If you run this failcase app.js, you will see that the button expands its height to be as tall as the neighboring label (height 90), even though the button has a specified height of 40. This is obviously wrong.

/*global Ti, Titanium, alert, JSON, require, setTimeout, setInterval */
Titanium.UI.setBackgroundColor('#000');
var win = Titanium.UI.createWindow({  
    title:'Test',
    backgroundColor:'#000',
    exitOnClose: true
});

var fieldContainer = Ti.UI.createView({
    height:280, width:320, top: 10,
    layout:'horizontal',
    backgroundColor:'red'
});
 
var field = Titanium.UI.createLabel({
    width:256, height:90, top:0, left:0,
    text: 'test label 256x90',
    backgroundColor: 'blue'
});
 
 
var button = Ti.UI.createButton({
    height:40,width:40, top:10, left: 5,
    title: 'x'
});
 
fieldContainer.add(field);
fieldContainer.add(button);
 
win.add(fieldContainer);

win.add( 
    Ti.UI.createLabel({
        bottom: 10, 
        text: "The fail case was that the button on the right above (button 'x') would expand its height to be as tall as the neighboring blue label, instead of having a height of 40 px as specified in the code.  So if the button looks 'normal' and not stretched vertically to be the height of the blue label, then the test has passed."
}));

win.open();

Comments

  1. Bill Dawson 2011-04-15

    (from [b1b596447eefe9eda06d4b40348546ae0f64255b]) [#2897 state:fixed-in-qa] Fix child heights in horizontal layouts https://github.com/appcelerator/titanium_mobile/commit/b1b596447eefe9eda06d4b40348546ae0f64255b"> https://github.com/appcelerator/titanium_mobile/commit/b1b596447eef...

  2. Bill Dawson 2011-04-15

    (from [16f5a38255d2e3f3f533126c42cc31ddb3b38465]) [#2897 state:fixed-in-qa] Properly calculalte position of 'wrapped line' in horizontal layout https://github.com/appcelerator/titanium_mobile/commit/16f5a38255d2e3f3f533126c42cc31ddb3b38465"> https://github.com/appcelerator/titanium_mobile/commit/16f5a38255d2...

  3. Don Thorp 2011-04-15

    Verified on G1/1.6 and Nexus One/2.2.1 using build #e1cb22a

JSON Source