I will try to file a bug report for this later, but I wanted to post this just in case anyone has been seeing it - sorry if it’s a repost (it’s really late here and I just want to get finished right now…)
When creating a tab bar widget the tab bar will default it’s touch area to the width of the screen, regardless of the width value passed in. Even though the tab buttons will be properly spaced, the touch zones are not, so they will overlap.
I wanted to have my tab buttons closer together and leave some whitespace either side of the bar, so I have to define a fake button at index 1 and 6 (I have 4 tabs.)
The problem with this is that the tabs at the ends are actual tabs, so I thought I would simply attach a listener to them to set the selected tab as the tab next to them. Fake tab #1 would set #2 and fake tab #6 would set #5. This works fine for fake tab #6 but fake tab #1 does not fire unless the onPress function has a slight delay - implemented with a timer…
local tabButtons = { { id="one", label="", onPress=function() timer.performWithDelay(10, function() tabbar:setSelected(2) end, 1 ) end, width=80, height=80, selected=false, }, { id="natonal", label="", onPress=listener, width=80, height=80, defaultFile="nationaloff.png", overFile="nationalon.png", selected=false, }, { id="global", label="", onPress=listener, width=80, height=80, defaultFile="globaloff.png", overFile="globalon.png", selected=true, }, { id="nearby", label="", onPress=listener, width=80, height=80, defaultFile="nearbyoff.png", overFile="nearbyon.png", selected=false, }, { id="friends", label="", onPress=listener, width=80, height=80, defaultFile="friendsoff.png", overFile="friendson.png", selected=false, }, { id="two", label="", onPress=function() tabbar:setSelected(5) end, width=80, height=80, selected=false, }, } -- Create tabbar at bottom of the screen tabbar = widget.newTabBar{ top = display.actualContentHeight, width = display.actualContentWidth, buttons = tabButtons }