[TIMOB-26719] Android: ListView no longer applying default row height
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-01-15T00:32:18.000+0000 |
Affected Version/s | Release 8.0.0 |
Fix Version/s | Release 8.0.0 |
Components | Android |
Labels | ListView, android, height, regression, row |
Reporter | Joshua Quick |
Assignee | Gary Mathews |
Created | 2019-01-12T04:53:53.000+0000 |
Updated | 2019-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
File | Date | Size |
---|---|---|
ListView-bad.png | 2019-01-12T04:52:10.000+0000 | 128277 |
ListView-good.png | 2019-01-12T04:52:10.000+0000 | 81699 |
master: https://github.com/appcelerator/titanium_mobile/pull/10614 8_0_X: https://github.com/appcelerator/titanium_mobile/pull/10615
FR Passed.
Closing ticket, Verified fix in SDK Version
8.1.0.v20190115054502
and SDK version8.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