2
votes

i have set a gridlayout with 3 column in a form. Each cell has a button set as below.

findLiveTraffic(f).setIcon(liveTraffic);
findLiveTraffic(f).getAllStyles().setBgColor(0x33739f);

findReports(f).setIcon(trafficReport);
findReports(f).getAllStyles().setBgColor(0x33739f);

and so on.

It works great when i view it in portrait and then if i swap to landscape too, layout fits fine. But if i first view the app in landscape mode when it starts and then to portrait, the buttons and its icon are scaled out of proportion in the portrait ( the landscape is only fine).

first viewed in landscape:

enter image description here

now in portrait:

enter image description here

However if i view it in portrait first when the app starts it works fine in both view. How can i fix it?

1
This is related to your other question stackoverflow.com/questions/35216515/…, and 2 answers were provided - Diamond
no there i set bgImage but here i cannot set bg image because there is already bg color set and i need icon too. Does adding orientation is only solution, i thought codename one auto scale to fit in both landscape and portrait, isnt it or my problem is a bug. I am afraid i have quite a bit of the problems related to grid layout designs. - beck
Why don't you enclose them in a container and set container bg color and set the component's bgImage - Diamond
ok thats a good idea, thankyou. I'll try it - beck

1 Answers

1
votes

Enclose LiveTraffic and Reports in a container, set the background color of that container and set the background image of the components to your images:

findLiveTraffic(f).getAllStyles().setBgImage(liveTraffic);
findLiveTrafficContainer(f).getAllStyles().setBgColor(0x33739f);

findReports(f).getAllStyles().setBgImage(trafficReport);
findReportsContainer(f).getAllStyles().setBgColor(0x33739f);