TableView header font size

You must Login before you can answer or comment on any questions.

I need to change the font size of the header label thing in my tableview. I have this right now:

xhr = Ti.Network.createHTTPClient({
    onload: function(e)
    {
        var response = JSON.parse(this.responseText);
        for (var i = 0; i < response.length; i++)
        {
            var projectTitle = response[i].title;
            for (var j = 0; j < response[i].vforums.length; j++)
            {
                if (j == 0)
                {
                    projectData.push({
                        color:'#000',
                        title:response[i].vforums[j].title,
                        hasChild:true,
                        header:projectTitle,
                        vforumLocation:response[i].vforums[j].location
                    });
                }
                else
                {
                    projectData.push({
                        color:'#000',
                        title:response[i].vforums[j].title,
                        hasChild:true,
                        vforumLocation:response[i].vforums[j].location
                    });
                }
            }
        }
        projectList.data = projectData;
        projectList.addEventListener('click',rowClick);
    },
    onerror: function(e)
    {
        Ti.API.debug(e);
        alert('error ' + e.error);
    },
    timeout: 5000
});
iOS looks good, but android, the text is super small

3 Answers

Accepted Answer

Yess thats an issue ,but to get rid of this create a the lables and add on table rows ,assing the font size to lable according to your requirement.

— answered 11 months ago by Moiz Chhatriwala
answer permalink
2 Comments
  • I ended up doing that. Create a custom row header and now I can adjust it how I like

    xhr = Ti.Network.createHTTPClient({
        onload: function(e)
        {
            var response = JSON.parse(this.responseText);
            for (var i = 0; i < response.length; i++)
            {
                var projectTitle = response[i].title;
                for (var j = 0; j < response[i].vforums.length; j++)
                {
                    if (j == 0)
                    {
                        // Custom header row
                        var headerLabel = Ti.UI.createLabel({
                            width:'100%',
                            color: '#fff',
                            text: ' ' + projectTitle,
                            textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT,
                            font: {
                                fontFamily:'Arial',
                                fontWeight:'bold',
                                fontSize:14
                            }
                        });
                        var headerView = Ti.UI.createView({
                            backgroundColor: '#555',
                            height: 35,
                            width:'100%'
                        });
                        headerView.add(headerLabel);
     
                        var headerSection = Ti.UI.createTableViewSection({
                            headerView: headerView
                        });
                        projectData.push(headerSection);
                    }
                    // Add the selectable row
                    var row = Ti.UI.createTableViewRow({
                        color:'#000',
                        title:response[i].vforums[j].title,
                        hasChild:true,
                        vforumLocation:response[i].vforums[j].location
                    });
                    projectData.push(row);
                }
            }
            projectList.data = projectData;
            projectList.addEventListener('click',rowClick);
        },
        onerror: function(e)
        {
            Ti.API.debug(e);
            alert('error ' + e.error);
        },
        timeout: 5000
    });

    — commented 11 months ago by Ronnie Swietek

  • Found another bug. Using the code above, the visible list on the device is fine, the headers are correct. As you scroll through and the list item headers are all out of order. I was able to Ti.API.warn the index and in logcat it was all correct, but visibly the titles are wrong. On iOS it works fine, of course. Looks like its back to the drawing board.

    — commented 11 months ago by Ronnie Swietek

check the JIRA I am pretty certain that is a known issue

Is there any update on this issue? I'm also running into the same problem and would like to know if this issue has been resolved yet with Titanium or if there is a way to fix it. Please let us know.

— answered 5 months ago by Timothy Taylor
answer permalink
1 Comment
  • @Timothy - this is not a problem the fixed nature of the header (and footer) titles is by design.

    You can create a custom headerView (or footerView) to solve your problem, the answer is actually in the marked answer.

    If you are not sure how - start a fresh question of your own and I will show you.

    — commented 5 months ago by Malcolm Hollingsworth

Your Answer

Think you can help? Login to answer this question!