Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10485] Android: e.source.size of a view nested inside another view and in a tableViewRow, returns 0

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-09-03T03:53:36.000+0000
Affected Version/sRelease 2.1.1
Fix Version/sRelease 3.0.0, Sprint 2012-18 API
ComponentsAndroid
LabelsSupportTeam, api, module_view, qe-review, qe-testadded
ReporterFederico Casali
AssigneeHieu Pham
Created2012-08-17T11:02:19.000+0000
Updated2013-11-07T05:53:21.000+0000

Description

Problem description

On Android, 'e.source.size.height' and 'e.source.size.width' relative to a view nested inside another view, inside a tableViewRow, returns 0 Issue it's only occurring on Android. On iOS correctly returns the right values.

Sample code and steps to reproduce

var win = Ti.UI.createWindow({
	backgroundColor:'gray'
});

var data = [];

var label = Ti.UI.createLabel({
	text:'nel mezzo del cammin di nostra vita...'
});

var view = Ti.UI.createView({
	backgroundColor:'blue',
	height:Ti.UI.SIZE,
	// width:Ti.UI.SIZE,
	width:210
});
view.addEventListener('postlayout',function(e){
      Ti.API.info('#### - ' + 'size.width: ' + e.source.size.width + ' - size.height: ' + e.source.size.height);
    });

var view2 = Ti.UI.createView({
	backgroundColor:'orange',
	height:Ti.UI.SIZE,
	// width:Ti.UI.SIZE,
	width:250
});

view.add(label);
view2.add(view);

var tvr = Ti.UI.createTableViewRow({
	backgroundColor:'yellow'
});
tvr.add(view2);

data.push(tvr);

var tv = Ti.UI.createTableView({
	data:data
});


win.add(tv);

win.open();
Run the sample code and check the log for the 'e.source.size.width' and 'e.source.size.height' values. Changing line 34 and just adding 'view' to the tableViewRow, then correct values are returned.

Comments

  1. Shyam Bhadauria 2012-08-27

    Environment used for verification - Tested with Titanium SDK: 2.2.0.v20120827143312 Tested with Titanium  Studio: 2.1.2.201208201549 Device - Android 2.2 emulator Machine OS - MAC 10.7.3
  2. Anshu Mittal 2012-09-03

    Reopening to update labels
  3. Shameer Jan 2013-11-07

    Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/4887

JSON Source