2011-08-10 30 views

回答

0

for iphone or android?

/* store sections in here */ 
var mySections = []; 

/* create section */ 
var mySection[0] = Ti.UI.createTableViewSection({ 
    headerTitle:"first section" 
}) 

/* tableview row to store checkbox */ 
var tableviewrow0 = Ti.UI.createTableViewRow(); 

/* if you don't want to build your own UI element you need 
* to use the provided elements. checkboxes aren't standard 
* ui elements, so you need to use switcher 
*/ 
var switcher0 = Ti.UI.createSwitcher({ 
    value: true, // or false 
    right: 10 // place it onto right side 
}); 
tableviewrow0.add(switcher0); 

/* label */ 
var label0 = Ti.UI.createLabel({ 
    value:"option one", 
    textAlign:"left", 
    left:10 
}); 
tableviewrow0.add(label0); 

/* add row to section*/ 
mySection[0].add(tableviewrow0); 

/* tableview */ 
var tbv = Ti.UI.createTableView({ 
    data:mySection 
}); 
win.add(tbv); 

您需要繼續下一行和部分。我沒有編譯它,所以要小心;這只是一個想法。對於android有特殊的喜好;請查看kitchensink

+0

你說的對android有特殊偏好。我在我的res文件夾下創建了一個preferences.xml。問題是我找不到方法來檢查複選框的狀態是選中還是未選中。 – jan

+0

您需要檢查checkbox.value值。最好的辦法是在變化事件中作出反應。 checked表示checkbox.value = true。 – mkind

+0

你的意思是我必須檢查android:key =「checkbox」/>? – jan

相關問題