Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16367] Android: Nested layout issue with Android

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2017-08-15T18:00:21.000+0000
Affected Version/sRelease 3.2.0
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, layout, nested, parity, views
ReporterPaul Hamilton
AssigneeEric Merriman
Created2014-02-03T18:16:25.000+0000
Updated2017-08-15T18:00:21.000+0000

Description

When a vertical layout is nested within a horizontal layout on an android device. The views don't work properly. The height of the vertical view is added to the horizontal view, and the vertical view is not centered in the horizontal view as it should be (with no top property set) works correctly in iphone, see the iphone result for what i expect should be occurring. Notice on android the blue extending past the image (the added height, seemingly equal to the height of the red) and the vertical layout view docked to the top of the horizontal view, should be centered With dynamic data coming in, i'm not sure of a workaround. Alloy: xml:
<Alloy>
    <Window class="container">
		<View class="horizontal">
			<ImageView></ImageView>
			
			<View class="vertical">
				<Label id="label1"></Label>
				<Label id="label2"></Label>
			</View>
		</View>
    </Window>
</Alloy>
tss:
"ImageView":{
	image: "/appicon.png",
	height: 64,
	width: 64
}

".horizontal": {
	layout: "horizontal",
	width: Ti.UI.FILL,
	height: Ti.UI.SIZE,
	backgroundColor: "blue"
}


".vertical": {
	layout: "vertical",
	width: Ti.UI.FILL,
	height: Ti.UI.SIZE,
	backgroundColor: "red"
}

"Label":{
	width: Ti.UI.SIZE,
	height: Ti.UI.SIZE,
}

"#label1": {
	text: "Label 1 text",
	color: "black"
}

"#label2": {
	text: "Label 2 text",
	color: "black"
}

Attachments

FileDateSize
Screenshot-Android.png2017-08-15T17:59:13.000+000046392
Screenshot-iOS.png2017-08-15T17:59:13.000+000052152

Comments

  1. Ritu Agrawal 2014-02-04

    Moving this ticket to engineering as I can reproduce this issue on Android platform. It works as expected on iOS platform so it is a parity issue.
  2. Paul Hamilton 2014-05-27

    still in 3.3 This but is killing my android design. Any chance for an update?
  3. Zeshan Bilal 2014-09-10

    So glad someone already posted this bug. Thought, I was the only one(TC-4691) having this issue. Thought I could use but that didn't help. At the moment the only work around would be to not nest the views for Android. Instead you would treat each view as a
    tag in html and position/align using TSS file.
  4. Joshua Quick 2017-08-15

    Not a bug. This is working as expected. The horiztonal view will be set to the height based on the tallest child view (in this case, the image). I've also verified that the vertical view is correctly centered vertically within the horizontal view. Attached screenshots showing it working correctly on both Android and iOS.

JSON Source