Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5120] Android: Horizontal layout adds extra padding on the top

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-03-21T17:26:37.000+0000
Affected Version/sRelease 1.7.2, Release 2.1.0
Fix Version/sn/a
ComponentsAndroid
Labelscore, exalture
ReporterKarol Pomaski
AssigneeSunila
Created2011-08-26T11:33:10.000+0000
Updated2017-03-21T21:29:40.000+0000

Description

Problem

The Horizontal layout does not work correctly, it adds extra padding on the top. On iOS works correctly. Please take a look at the screenshots I posted within this issue.

Regression

Please run the code below(I attached project with example image). After running you would show a blue space which is the views background color. The images should start filling the view from the top-left (like in iOS).

Sample Code

// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');

PlatformWidth = Ti.Platform.displayCaps.platformWidth;
PlatformHeight = Ti.Platform.displayCaps.platformHeight;
$X = function(x) { return Math.round(x*(PlatformWidth/320)); }
$Y = function(y) { return Math.round(y*(PlatformHeight/480)); }

var win1 = Titanium.UI.createWindow({backgroundColor:'#fff' });



var grid = Ti.UI.createView({left: $X(7), right: $X(7), layout: 'horizontal', borderRadius:5, backgroundColor:"blue", height:$Y(3*79)});
grid.add(Ti.UI.createButton({ width: $X(101), height: $Y(78), backgroundImage: 'places.png' }));
grid.add(Ti.UI.createButton({ width: $X(101), height: $Y(78), backgroundImage: 'places.png' }));
grid.add(Ti.UI.createButton({ width: $X(101), height: $Y(78), backgroundImage: 'places.png' }));
grid.add(Ti.UI.createButton({ width: $X(101), height: $Y(78), backgroundImage: 'places.png' }));
grid.add(Ti.UI.createButton({ width: $X(101), height: $Y(78), backgroundImage: 'places.png' }));
grid.add(Ti.UI.createButton({ width: $X(101), height: $Y(78), backgroundImage: 'places.png' }));
grid.add(Ti.UI.createButton({ width: $X(101), height: $Y(78), backgroundImage: 'places.png' }));
grid.add(Ti.UI.createButton({ width: $X(101), height: $Y(78), backgroundImage: 'places.png' }));
grid.add(Ti.UI.createButton({ width: $X(101), height: $Y(78), backgroundImage: 'places.png' }));				
	
win1.add(grid);

win1.open();

Attachments

FileDateSize
AndroidHorizontal.zip2011-08-26T11:33:10.000+00002556110
urg1.png2011-08-26T11:33:10.000+000065088
urg2.png2011-08-26T11:33:10.000+0000123794

Comments

  1. Max Stepanov 2012-05-30

    Layout bug confirmed with 2.1.0 master builds.
  2. Sunila 2013-03-21

    I cannot reproduce this issue. Tried with SDK 3.1.0
  3. Lee Morris 2017-03-21

    Closing ticket as the issue cannot be reproduced.

JSON Source