Hi everybody,
I tried to use the new widget tableview library, it works perfectly on the iphone and the simulator.
Its not working correctly on android : you can’t touch the rows, you can scroll them but you can’t select one.
Give it a try :
-- main.lua local widget = require( "widget" ) local numRows = 40 ; local function tableViewListener( event ) print( event.direction ) print( event.isLimitReached ) end local function onRowRender( event ) local phase = event.phase local row = event.row local rowTitle = display.newText( row, "Row " .. row.index, 0, 0, nil, 14 ) rowTitle.x = row.x - ( row.contentWidth \* 0.5 ) + ( rowTitle.contentWidth \* 0.5 ) rowTitle.y = row.contentHeight \* 0.5 rowTitle:setTextColor( 0, 0, 0 ) end local function onRowUpdate( event ) local phase = event.phase local row = event.row print( row.index, ": is now onscreen" ) end local function onRowTouch( event ) local phase = event.phase if ( "release" == phase ) then print( "Touched row:", event.target.index ) native.showAlert( "Info", "Touched row: " .. event.target.index, { "OK" } ) end end local tableView = widget.newTableView { left = 0, top = 52, width = 320, height = 366, hideBackground = true, maskFile = "assets/mask-320x366.png", listener = tableViewListener, onRowRender = onRowRender, onRowUpdate = onRowUpdate, onRowTouch = onRowTouch, maxVelocity = 1.0, friction = 0.972, noLines = false, } for i=1,numRows do tableView:insertRow { isCategory = false, rowHeight = 80, rowColor = { default={ 255, 255, 255 }, over={ 0, 175, 250 } }, lineColor = { 150, 150, 150, 50 }, } end
I zipped the app, to let you try easily,
Thanks,
Edit :
(i’m using a nexus 4 phone, sorry for double post)