Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18891] Android: setHeaderView method not exist

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionInvalid
Resolution Date2017-05-02T22:08:51.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsandroid, listview, setHeaderView
ReporterYiran Mao
AssigneeEric Merriman
Created2015-02-18T19:41:14.000+0000
Updated2017-05-02T22:08:51.000+0000

Description

*Description* The listView reports an error that the setHeaderView method not exist for listView object when trying to run it on android simulator and crashes. Setting the direct value for listView.headerView won't complain but neither does it show the headerView for the listView. There is actually a [Q&A](http://developer.appcelerator.com/question/161410/listview-does-not-have-method-setheaderview-on-android#answer-285954) related to this issue about 1 year ago, but it seems unnoticed and not resolved yet. *What's expected* As from the [latest document | http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.UI.ListView-method-setHeaderView], setHeaderView should be available since Android 3.2. So the inconsistency make me a little confused. *Step to reproduce* The following code is quoted from the sample given in listview documentation. I am trying to add a search bar as it suggested in the kitchensink sample. {quote} var win = Ti.UI.createWindow({ backgroundColor: 'white' }); var listView = Ti.UI.createListView(); var sections = []; var vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables' }); var vegDataSet = [ {properties: { title: 'Carrots'}}, {properties: { title: 'Potatoes'}}, ]; vegSection.setItems(vegDataSet); sections.push(vegSection); listView.sections = sections; var searchTextField = Ti.UI.createTextField({ borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED, color: '#333', height: Ti.UI.FILL, left:5, right:5, top: 5, bottom: 5, hintText: 'Search', clearButtonMode: Titanium.UI.INPUT_BUTTONMODE_ONFOCUS }); var searchBar = Ti.UI.createView({ backgroundColor: "#ccc", width: Ti.UI.FILL, height: "35dp" }); searchBar.add(searchTextField); listView.setHeaderView(searchBar); win.add(listView); win.open(); {quote}

Comments

  1. Simone Semprini 2015-05-02

    are there any news on this issue? I found the same problem and the only workaround I found is using the first section header as the list header, which is of course not optimal and works in my case just because I have always only one section in my list.
  2. Lee Morris 2017-05-02

    Resolving ticket as Invalid as there is now a new version of Kitchen Sink available and we no longer support the version which relates to this ticket.

JSON Source