桌面视图钛的背景图像
问题描述:
我正在制作需要实现TableView的应用程序。桌面视图钛的背景图像
我想将背景图像应用于tableview。
任何人都可以帮助我解决这个问题。 我使用下面的代码来创建表视图
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);
任何帮助将不胜感激。
答
如果你想要一个图像作为整个TableView的背景。在父视图中设置backgroundImage
,并且TableView
将backgroundColor
设置为transparent
。下面是修改为同一代码:
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);
你想在表格视图中的单个背景,或者你想这样的背景下出现在表视图中的每一行吗? – 2011-05-10 06:37:53