Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26719] Android: ListView no longer applying default row height

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2019-01-15T00:32:18.000+0000
Affected Version/sRelease 8.0.0
Fix Version/sRelease 8.0.0
ComponentsAndroid
LabelsListView, android, height, regression, row
ReporterJoshua Quick
AssigneeGary Mathews
Created2019-01-12T04:53:53.000+0000
Updated2019-01-15T15:01:05.000+0000

Description

*Summary:* ListView rows are supposed to have a default height if the template doesn't have one. On Android, the default height used to be 45dp (assigned [here](https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/TiDefaultListViewTemplate.java#L90)). As of Titanium 8.0.0, the default height is no longer being applied and the rows are auto-sizing to fit the height of the row's contents instead. *Steps to reproduce:*

Build and run the below code on Android.

Notice that the rows just-fit the height of the row text. (This is the problem.)

function createListViewSectionItems() {
	var items = [];
	for (var index = 1; index <= 100; index++) {
		items.push({ properties: { title: "Row " + index } });
	}
	return items;
}

var window = Ti.UI.createWindow();
window.add(Ti.UI.createListView({
	sections: [Ti.UI.createListSection({
		headerTitle: "ListView",
		items: createListViewSectionItems(),
	})],
}));
window.open();
*Result:* !ListView-bad.png|thumbnail! *Expected Result:* This is how it used to work in Titanium 7.x.x. !ListView-good.png|thumbnail! *Note:* We can't solve this issue by setting a min height to the row's root layout. While that would work, Titanium app developers have spoken out in the past that they don't want this behavior as can be seen in [TIMOB-19812]. We removed the min height as of Titanium 6.0.0 and we need to keep this behavior. But it's okay to apply a default height if one was not specified.

Attachments

FileDateSize
ListView-bad.png2019-01-12T04:52:10.000+0000128277
ListView-good.png2019-01-12T04:52:10.000+000081699

Comments

  1. Gary Mathews 2019-01-14

    master: https://github.com/appcelerator/titanium_mobile/pull/10614 8_0_X: https://github.com/appcelerator/titanium_mobile/pull/10615
  2. Keerthi Mahalingam 2019-01-15

    FR Passed.
  3. Samir Mohammed 2019-01-15

    Closing ticket, Verified fix in SDK Version 8.1.0.v20190115054502 and SDK version 8.0.0.v20190114160512. Test and other information can be found at: master: https://github.com/appcelerator/titanium_mobile/pull/10614 8_0_X: https://github.com/appcelerator/titanium_mobile/pull/10615

JSON Source