[AC-6634] Android: GridLayout support for ListViews/TableView
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | Michael Gangolf |
Assignee | Abir Mukherjee |
Created | 2020-11-21T15:30:54.000+0000 |
Updated | 2020-11-21T15:31:09.000+0000 |
Description
Since ListView/TableView now supports RecyclerView it is very easy to add simple multi-column support using a GridLayout.
TableView:
Ti.UI.backgroundColor = 'white';
var win = Ti.UI.createWindow();
var tableData = [ {title: 'Apples'}, {title: 'Bananas'}, {title: 'Carrots'}, {title: 'Potatoes'}, {title: 'Apples'}, {title: 'Bananas'}, {title: 'Carrots'}, {title: 'Potatoes'} ];
var table = Ti.UI.createTableView({
data: tableData,
gridColumns: 1
});
win.add(table);
win.open();
ListView
var win = Ti.UI.createWindow({backgroundColor: 'gray'});
var listView = Ti.UI.createListView({
gridColumns: 2
});
var sections = [];
var fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits'});
var fruitDataSet = [
{properties: { title: 'Apple'}},
{properties: { title: 'Banana'}},
];
fruitSection.setItems(fruitDataSet);
sections.push(fruitSection);
var vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables'});
var vegDataSet = [
{properties: { title: 'Carrots'}},
{properties: { title: 'Potatoes'}},
];
vegSection.setItems(vegDataSet);
sections.push(vegSection);
listView.sections = sections;
win.add(listView);
win.open();
var fishSection = Ti.UI.createListSection({ headerTitle: 'Fish'});
var fishDataSet = [
{properties: { title: 'Cod'}},
{properties: { title: 'Haddock'}},
];
fishSection.setItems(fishDataSet);
listView.appendSection(fishSection);
PR: https://github.com/appcelerator/titanium_mobile/pull/12284