Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7337] Android: Size.height and size.width are 0 for Views with height: "auto" and layout: "vertical"

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionDuplicate
Resolution Date2012-01-31T11:25:32.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labels1.8.0.1, android, v8
ReporterJustin Toth
AssigneeMauro Parra-Miranda
Created2012-01-23T10:14:36.000+0000
Updated2017-03-24T18:31:18.000+0000

Description

Using Ti 1.8.0.1 with Android and V8, Views with height: "auto" and layout: "vertical" have their size.height and size.width properties set to 0, even after the window is opened. Here is code to reproduce:
var win = Ti.UI.createWindow({ backgroundColor: "#fff" });
win.addEventListener("open", function() { 
	
	//create view.
	var view = Ti.UI.createView({ left: 0, right: 0, top: 0, layout: "vertical", height: "auto" });
	
	//create labels.
	var label1 = Ti.UI.createLabel({ text: "label 1", color: "#000", top: 0, left: 0, height: "auto" });
	view.add(label1);
	
	var label2 = Ti.UI.createLabel({ text: "label 2", color: "#000", top: 0, left: 0, height: "auto" });
	view.add(label2);
	
	win.add(view);
	
	//output view dimensions.
	Ti.API.info("view width: " + view.size.width);
	Ti.API.info("view height: " + view.size.height);

});
win.open();
Results: android 2.2 emulator (V8): view width: 0, view height: 0 <--incorrect droid x2 w/android 2.3.4 (V8): view width: 0, view height: 0 <--incorrect iphone simulator: view width: 320, view height: 44 <--correct

Comments

  1. Paul Dowsett 2012-01-26

    Possible duplicate of TIMOB-5303. Mauro to investigate.
  2. Mauro Parra-Miranda 2012-01-31

    This is a duplicate of TIMOB-5303.
  3. Justin Toth 2012-01-31

    If that is the case, can you at least update the priority level of TIMOB-5303 to critical? It is nearly impossible to build applications to support multiple resolutions in Android without access to the size properties on any elements.
  4. Mauro Parra-Miranda 2012-01-31

    Justin, thanks for your feedback. I talked with Platform Team, and they raised the priority. Will be fix ASAP. Please continue being as good as you are in the community and in this examples. I'm open to hear any opinion, bug or anything that will help to improve the platform. Best, Mauro mpmiranda@appcelerator.com
  5. Lee Morris 2017-03-24

    Closing ticket as duplicate with reference to the linked issues.

JSON Source