Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9994] Android: postlayout event not fired for labels

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-10-26T23:38:18.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sSprint 2012-15 Core, Release 2.1.4, Release 3.0.0
ComponentsAndroid
Labelscore, layout, module_label, qe-review, qe-testadded
ReporterFabianS
AssigneeAllen Yeung
Created2012-07-05T03:21:33.000+0000
Updated2013-11-07T05:27:49.000+0000

Description

On android no postlayout event is fired. On iOS, the postlayout event is fired once after adding the label to the window. If you change label properties, for example width, you can see that the properties are changed but no postlayout event is fired. The code snippet below is my simple testcase.
var win = Ti.UI.createWindow({
    backgroundColor : '#FFF',
    layout : 'vertical'
});

var label = Ti.UI.createLabel({
    text : "hello",
    left : 0,
    width : Ti.UI.SIZE,
    height : Ti.UI.SIZE
});

label.addEventListener("postlayout", function(e) {
    Ti.API.info("label postlayout");
    //alert("label post layout");
});

var doBtn = Ti.UI.createButton({
    title : "do",
    width : Ti.UI.SIZE,
    height : Ti.UI.SIZE
});

doBtn.addEventListener("click", function() {
    label.text = "new text";
    label.backgroundColor = '#F00';
    label.left += 20;

});
win.add(doBtn);
win.add(label);
win.open(); 

Attachments

FileDateSize
app.js2012-07-30T18:41:37.000+00003619

Comments

  1. Ivan Skugor 2012-07-05

  2. Allen Yeung 2012-07-30

    Test notes: I have attached an app.js with 12 test cases for the post layout event. At the very bottom of the app.js file, there are 3 groups of controls that you need to test. To make things easier to read, I would recommend running the app three times, each with a different group enabled. Each time you run the app, verify that the postlayout event prints out at least once for each control enabled (the postlayout event may be fired multiple times). Before my change, postlayout events don't fire for any of these controls
  3. Vishal Duggal 2012-07-31

    Fixed by PR https://github.com/appcelerator/titanium_mobile/pull/2660 against master
  4. Shyam Bhadauria 2012-08-16

    Environment used for verification - Tested with Titanium SDK: 2.2.0.v20120815194913 Tested with Titanium  Studio: 2.1.1.201207271312 Device - Samsung GALAXY Note Android 2.3.6 Machine OS - MAC 10.7.3
  5. Neha Chhabra 2012-09-07

    Reopening to update labels
  6. Allen Yeung 2012-10-26

    Backport: https://github.com/appcelerator/titanium_mobile/pull/3344
  7. Ping Wang 2012-10-26

    reopen to update fix versions.
  8. Natalie Huynh 2012-11-01

    Tested with 2.1.4.v20121030173408 on Droid 3 2.3.4
  9. Shameer Jan 2013-11-07

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

JSON Source