Project: titanium
Issue TIMOB-19796: Android: CardView Layout property not working as expected
The new {{Ti.UI.CardView}} is [documented|https://appcelerator.github.io/appc-docs/latest/#!/api/Titanium.UI.Android.CardView-property-layout] to support the {{layout}} property - as one would expect - but it does not behave as expected. The following sample code and attached screenshot demonstrates that none of the {{layout}} values work and that whatever mechanism is used by default is not composite since the labels are aligned top left instead of the expected centre. The first card has a view to wrap the labels to show what I'd expect for the other vertical-card to be like. However, there as well is shows that thew view is not filling up the parent as it normally does. {code:javascript} var win = Ti.UI.createWindow({	backgroundColor: 'white' }); function createCard(layout, wrap) {	var card = Ti.UI.Android.createCardView({	top: 20,	width: Ti.UI.FILL,	height: 160,	layout: layout	});	var view;	if (wrap) {	view = Ti.UI.createView({	layout: layout	});	card.add(view);	} else {	view = card;	}	view.add(Ti.UI.createLabel({	width: 50,	height: 100,	backgroundColor: 'green',	text: (wrap ? 'reference' : layout) + ' in green'	}));	view.add(Ti.UI.createLabel({	top: 10,	width: 100,	height: 50,	backgroundColor: 'red',	text: (wrap ? 'reference' : layout) + ' in red'	}));	return card; } var scrollView = Ti.UI.createScrollView({	layout: 'vertical' }); scrollView.add(createCard('vertical', true)); scrollView.add(createCard('composite')); scrollView.add(createCard('vertical')); scrollView.add(createCard('horizontal')); win.add(scrollView); win.open(); {code}
Story points: 8