gpt4 book ai didi

titanium - 桌面 View 钛的背景图像

转载 作者:行者123 更新时间:2023-12-02 08:54:35 27 4
gpt4 key购买 nike

我正在制作需要实现TableView的应用程序。

我想将背景图像应用到桌面 View 。

谁能帮我解决这个问题。我正在使用下面的代码来创建 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 的背景。在父 View 中设置 backgroundImage,并将 TableView 设置 backgroundColortransparent。以下是您修改后的代码:

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

关于titanium - 桌面 View 钛的背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5946033/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com