Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-14634

Android: Postlayout event does not fire on ImageViews that are in a ScrollableView

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Environment:

      Android using TiSDK 3.1.1
      Studio 3.1.1.201306112235

      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();
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              aroyce Andrew Royce
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-17052
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code