Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8466] MobileWeb: vertical aligned views need to center-align children

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionDuplicate
Resolution Date2012-03-31T14:54:59.000+0000
Affected Version/sRelease 2.0.0
Fix Version/sn/a
ComponentsMobileWeb
Labelsmw-list
ReporterKevin Whinnery
AssigneeBryan Hughes
Created2012-03-31T05:31:27.000+0000
Updated2014-01-28T23:48:58.000+0000

Description

I have a view with a vertical layout, and an image and a label as children. The label is left aligned. The expected behavior, which is default on native, is for an auto-size label to center horizontally. !https://img.skitch.com/20120331-pthpnir3wmjg18k27q8puhjurr.png!

Comments

  1. Bryan Hughes 2012-03-31

    Auto-sized labels are center-aligned by default in vertical alignments. There is probably some other subtly in your code causing the problems. Can you attach it?
  2. Bryan Hughes 2012-03-31

    As confirmation, you can run the following test case:
       
       var win1 = Titanium.UI.createWindow({  
           title:'Tab 1',
           backgroundColor:'#fff'
       });
       win1.open();
       
       var container = Ti.UI.createView({
       	left: 10,
       	right: 10,
       	top: 10,
       	bottom: 10,
       	layout: "vertical"
       });
       win1.add(container);
       
       container.add(Ti.UI.createImageView({
       	image: "KS_nav_ui.png",
       	width: 100
       }));
       container.add(Ti.UI.createLabel({
       	text: "hi"
       }));
       
  3. Bryan Hughes 2012-03-31

    After doing some investigation, it turns out this bug is fixed in TIMOB-7799, which is currently waiting in pull request. There was a problem with alignment with vertical when the container and the child were both SIZE combined with a few other parameters (very subtle).

JSON Source