Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13140] [android] label with height = T.UI.SIZE and no text not sizing correctly in layout

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionNot Our Bug
Resolution Date2014-01-29T16:28:23.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, height, label
ReporterMartin Guillon
AssigneeIngo Muschenetz
Created2012-10-15T07:34:33.000+0000
Updated2017-03-22T21:55:16.000+0000

Description

look at the test case, the second containing blue view should have an height of 0. Instead it has the height of the label as if it had text. Replace the second label with a view and see how it should work
var win = Titanium.UI.createWindow();
win.backgroundColor = '#ccc';

var container = Ti.UI.createView({
    	height:70,
    	top:0,
    	layout:'vertical',
    	backgroundColor:'red'
   	})
var view = Ti.UI.createView({
	height:Ti.UI.SIZE,
    backgroundColor:'blue'
   	})
container.add(view);

var view2 = Ti.UI.createLabel({
	height:Ti.UI.SIZE,
	backgroundColor:'green',
	text:'TEST'
})
view.add(view2);
win.add(container);

container = Ti.UI.createView({
    	height:70,
    	top:100,
    	layout:'vertical',
    	backgroundColor:'red'
   	})
view = Ti.UI.createView({
	height:Ti.UI.SIZE,
    	backgroundColor:'blue'
   	})
container.add(view);

view2 = Ti.UI.createLabel({ //create a view instead here and it works
	height:Ti.UI.SIZE,
	backgroundColor:'green'
})
view.add(view2);


win.add(container);
win.open();

Comments

  1. Sunila 2014-01-29

    In Android textView, for simple text, layout (BoringLayout) assumes that the line count is 1 and the desired height is for this (if height is not specified).
  2. Lee Morris 2017-03-22

    Closing ticket as the issue mentioned here is not our bug.

JSON Source