Strange behaviour when using custom images for buttons in lanscape mode
I have a toolbar using the following code
var bottomBarPlay = Titanium.UI.createToolbar({
items:[action,flexSpace,left,flexSpace,play,flexSpace,right,flexSpace,thumbnail,change],
bottom:0,
borderTop:true,
borderBottom:true,
barColor: '#000',
opacity: 0.6,
});
Without setting a width - the toolbar will automatically extend when in landscape mode but the height of the bar reduces and any non Titanium.UI.iPhone.SystemButtons (ie any images that are used instead) will get distorted as demonstrated in the screenshot.
portrait mode
landscape mode
Setting a toolbar width using
bottomBarPlay.width = 320;
Will fix the issue but in landscape mode the bar will only only ever be 320px of the available 480px
I'm using the images and following the scroll_views_scrollable.js. However, in that example it's setting the window toolbar which I'm assumming is handling the width and height. I'm using
win.add(bottomBarPlay);
not like the example which sets the window toolbar using
win.setToolbar([flexSpace,left,change,add,jump,right,flexSpace]);
Whats the best way to fix this issue?
2 Answers
-
The solution i've found:
Make the button image a backgroundImage, and then set width/height of the button. This stops the weird distortion. -
Solution to this problem here.