Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14634] Android: Postlayout event does not fire on ImageViews that are in a ScrollableView

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsandroid, parity, scrollableView
ReporterAndrew Royce
AssigneeUnknown
Created2013-07-19T01:09:47.000+0000
Updated2018-02-28T20:03:57.000+0000

Description

Problem

I have x amount of ImageViews that are all different sizes. For each ImageView I have captions (labels) that overlay the image and the coords are set by a left/top percentage. The problem is the only way to currently retrieve these views is to get a reference to the currentview and call the toImage method to get the size. I would think by adding a post layout to each view or to the ScrollableView you should be able to get that views size when it is scrolled to.

Snippet

var imageViewArray = [];
var colors = ['red', 'orange', 'yellow'];

for (var c = 0; c < colors.length; c++) {
	//Views work, ImageViews do not.
	var iv = Ti.UI.createImageView({
	//var iv = Ti.UI.createView({ //it works	
		backgroundColor : colors[c],
		width : '100%',
		height : '100%'
	});

	iv.addEventListener('postlayout', function() {
		//alert('hoping this would work ');
		Ti.API.info(' hoping this would work: ' + c);
	});

	imageViewArray.push(iv);
}

var self = Titanium.UI.createScrollableView({
	views : imageViewArray,
	currentPage : 0,
});
self.addEventListener('postlayout', function() {
	alert('this only is for Scrollableview');
}); 

var win = Ti.UI.createWindow();
win.add(self);
win.open();

Comments

  1. Andrew Royce 2013-07-19

    [Moved to description]
  2. Andrew Royce 2013-08-11

    Do you need anything else from me to get this pushed closer to a fix?

JSON Source