Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16707] Android:TableView Row height doesn't resize when multiple views are added

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.2.1, Release 3.2.2
Fix Version/sn/a
ComponentsAndroid
LabelsRTN, engTriage, supportTeam
ReporterRupesh Sharma
AssigneeUnknown
Created2014-03-26T12:00:54.000+0000
Updated2020-01-15T19:02:59.000+0000

Description

Description

TableView Row height doesn't resize when adding multiple views. But once tableview scrolls, rows height will adjust as expected.

Test Case

Ti.UI.backgroundColor = 'white';
var win = Ti.UI.createWindow();


var section1 = Ti.UI.createTableViewSection();

var data = {
		latitude : '1',
		longitude : '1',
		image : 'Y',
		isImg : true

	};
	
var infoRow = Ti.UI.createTableViewRow({
		height : Ti.UI.SIZE,
		width : Ti.UI.FILL,
		backgroundColor : 'transparent',
		selectedBackgroundColor : 'transparent'
	});
	
var infoView = Ti.UI.createView({
		layout : 'horizontal',
		height : Ti.UI.SIZE,
		width : Ti.UI.FILL,
		top : 10,
		bottom : 10,
		backgroundGradient : {
			type : 'linear',
			startPoint : {
				x : '0%',
				y : '75%'
			},
			endPoint : {
				x : '75%',
				y : '0%'
			},
			colors : [{
				color : '#E9EEF0',
				offset : 0.0
			}, {
				color : '#25E9EEF0',
				offset : 1.0
			}]
		}
	});

	var detail = Ti.UI.createView({
		layout : 'vertical',
		left : '3%',
		right : '3%',
		height : Ti.UI.SIZE,
		horizontalWrap : false,
		top : 7,
		backgroundColor : 'transparent'
	});

	if (data.image === 'Y') {
		infoView.add(Ti.UI.createImageView({
			image : 'KS_nav_views.png',
			height : 80,
			width : 80
		}));
		detail.width = '65%';
	} else {
		detail.width = '94%';

	}
	infoView.add(detail);

	var title = Titanium.UI.createLabel({
		text : 'dfdfdfd fgffgfgg',
		horizontalWrap : true,
		font : {
			fontSize : 15,
			fontWeight : 'bold'
		},
		color : 'black',
		left : 0
	});
	detail.add(title);

	if (data.isImg) {
		var netImage = Ti.UI.createImageView({
			left : 0,
			image : 'KS_nav_ui.png',
			height : Ti.UI.SIZE,
			width : Ti.UI.SIZE,
			top : 3,
			bottom : 3
		});

		detail.add(netImage);
	}

	var subTitle = Titanium.UI.createLabel({
		text : 'fgfgfgfgfg',
		horizontalWrap : true,
		color : 'black',
		left : 0,
		font : {
			fontSize : 14
		}
	});
	detail.add(subTitle);

	var address = Titanium.UI.createLabel({
		text : 'gfgfgfgf',
		horizontalWrap : true,
		color : 'black',
		left : 0,
		font : {
			fontSize : 14
		}
	});
	detail.add(address);
	if (data.latitude !== null && data.longitude !== null) {
		var map = Ti.UI.createView({
			height : Ti.UI.SIZE,
			layout : 'horizontal',
			left : 0,
			top : 10,
			bottom : 10,
			width : Ti.UI.SIZE
		});

		var mapImage = Ti.UI.createImageView({
			image : 'map.png',
			left : 0
		});

		var mapLabel = Ti.UI.createLabel({
			width : Ti.UI.SIZE,
			text : 'See Map',
			font : {
				fontSize : 14,
				fontWeight : 'bold'
			},
			left : '7%',
			color : 'red'
		});

		map.add(mapImage);
		map.add(mapLabel);
		detail.add(map);

		map.addEventListener('click', function(e) {
			alert('Clicked');
		});

	} else {
		address.bottom = 10;
	}
	
	infoRow.add(infoView);
	section1.add(infoRow);

var section2 = Ti.UI.createTableViewSection({ headerTitle: 'Sample' });

var table = Ti.UI.createTableView({
  data: [section1, section2]
});

win.add(table);
win.open();


for(i=1;i<=30;i++){
section2.add(Ti.UI.createTableViewRow({ title: 'Row '+i, height:50 }));
}

Steps to Reproduce

1. Create a project with above sample code and run on android device Note : Notice that top row's height is not adjusted properly at first. 2. Scroll the table view down and then again on top. Note : Now you will notice that height is adjusted as expected. Expected Result Height of tableViewRow should be adjusted automatically on application launch Actual Result Height is not adjusted properly at first but after scrolling it gets adjusted

Comments

  1. jithinpv 2014-09-04

    Issue reproduces Titanium SDK version 3.4.0 master, 3.2.2.GA Titanium Studio, build: 3.3.0.201407100905 Titanium Command-Line Interface CLI version 3.3.0, Android device : Samsung Galaxy S3, Android version : 4.3
  2. Alessio Failla 2015-08-24

    @cng this also happens in the latest SDK+
  3. Ashraf Abu 2015-08-25

    Hi [~afailla]. Could you give more information and detail on what you are seeing? Device information, screenshots and any other information would be very useful.
  4. Alessio Failla 2015-08-25

    Hi @Ashraf Abu - I am going to upload a sample project.
  5. Alessio Failla 2015-08-25

    Issue reproduces - see sample project here: https://www.dropbox.com/s/6o2v7zqjixqlmuk/TIMOB16707.zip?dl=0 Appcelerator Studio, build: 4.1.1.201507141126 CLI version 4.0.1 Tested on Nexus7 Android 4.1.1 but also able to replicate on any other Android device I have got such as S4, S5 and also on latest Android version. Steps to reproduce as described in the test case above. Thanks
  6. Ashraf Abu 2015-08-25

    [~afailla] Thank you for the sample project.
  7. Alessio Failla 2015-08-29

    When is Sprint 18? (I am guessing the fix will be something similar to https://github.com/appcelerator/titanium_mobile/commit/700cae1e338ca3e129488ece1fdc4f774f9d863f)
  8. Alessio Failla 2015-09-19

    Any ideas when this ticket will be resolved? Thank you!

JSON Source