Background image for tableview Titanium
I am making application which requires to implement Tabl开发者_JS百科eView.
I want to apply background image to tableview.
Can anybody help me to resolve this issue. I am using below code to create Table view
Titanium.UI.setBackgroundColor('#FFF');
var win = Titanium.UI.currentWindow;
var data = [
{title:'Owner Description:'+' '+Titanium.App.Properties.getString("latitude"),hasChild:false,color:'blue', selectedColor:'#fff', setFont:10},
{title:'TerminalDescription:'+' '+Titanium.App.Properties.getString("TerminalDesc"),hasChild:false},
{title:'Address:'+' '+Titanium.App.Properties.getString("address"),hasChild:false},
{title:'City:'+' '+Titanium.App.Properties.getString("city"),hasChild:false},
{title:'State:'+' '+Titanium.App.Properties.getString("state"),hasChild:false},
{title:'Zip:'+' '+Titanium.App.Properties.getString("Zip"),hasChild:false},
{title:'Surcharge Amount:'+' '+Titanium.App.Properties.getString("Charge"),hasChild:false},
];
var tableview = Titanium.UI.createTableView({
data:data,
opacity:'.4',
maxRowHeight:'20',
//Set BG transparent
backgroundColor:'transparent',
backgroundImage:'Default.png',
//Set row color - white
rowBackgroundColor:'white'
});
win.add(tableview);
any help will be appreciated.
If you want a single image as a background to the whole TableView. Have a backgroundImage
set in the parent view and for TableView
set the backgroundColor
to transparent
. Following is your code modified for the same:
var win = Titanium.UI.currentWindow;
setBackgroundImage('Default.png');
var data = [ ... ];
var tableview = Titanium.UI.createTableView({
data:data,
maxRowHeight:'20',
backgroundColor:'transparent', //Set BG transparent
rowBackgroundColor:'white'
});
win.add(tableview);
Reference
精彩评论