Setting backgroundGradient on a TableView?

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

Here is my code, but for some reason the backgroundGradient does not apply to the TableView. Using SDK 1.6.1 and iOS 4.3.

var win = Ti.UI.currentWindow;
 
var basicInfo_pageView = Ti.UI.createView({
    backgroundColor:'#fff'
});
 
var scrollView = Ti.UI.createScrollableView({
    views:[basicInfo_pageView],
    showPagingControl:true,
    pagingControlColor:'#999',
    pagingControlHeight:15,
    currentPage:0
});
 
var basicInfo_data = [];
 
var basicInfo_tableView = Ti.UI.createTableView({
    data:basicInfo_data,
    style:Ti.UI.iPhone.TableViewStyle.GROUPED,
    backgroundGradient:{
        type:'linear',
        colors:[
            {color:'#d4d4d4',position:0.0},
            {color:'#666666',position:0.50},
            {color:'#b4b4b4',position:1.0}
        ]
    }
});
 
basicInfo_pageView.add(basicInfo_tableView);
win.add(basicInfo_pageView);
This is all I get: (Note in this image there are more Views in my ScrollableView, but they don't have to do with this)

Why no BackgroundGradient?

1 Answer

Gradient backgrounds in tableViews has always been dicy at best. (It still doesn't even work on Android)

My best advice is to use the backgroundImage property.

Your Answer

Think you can help? Login to answer this question!