JOFA666 Member Licensed User Longtime User Oct 10, 2012 #1 :sign0104: I am new to B4A so please be nice. I am currently creating a game and want to make my application able to the change the layout variant when the screen rotates. What code can I use to make this possible. I have already designed my 2 layout variants for this, but how can I make my application detect when the screen changes and then change the layout automatically. Thanks.
:sign0104: I am new to B4A so please be nice. I am currently creating a game and want to make my application able to the change the layout variant when the screen rotates. What code can I use to make this possible. I have already designed my 2 layout variants for this, but how can I make my application detect when the screen changes and then change the layout automatically. Thanks.
Kevin Well-Known Member Licensed User Longtime User Oct 10, 2012 #2 If you design a layout for both portrait and landscape then Android will handle that for you. If you want to do it through code then you could see if Activity.Height > Activity.Width then load the portrait variant. Otherwise if width is > height then load landscape. Obviously you also need to make sure that both orientations are permitted in the project's settings. Upvote 0
If you design a layout for both portrait and landscape then Android will handle that for you. If you want to do it through code then you could see if Activity.Height > Activity.Width then load the portrait variant. Otherwise if width is > height then load landscape. Obviously you also need to make sure that both orientations are permitted in the project's settings.