C Cor Active Member Licensed User Longtime User Dec 16, 2010 #1 It's not clear to me how to make a program which fits automatically to the following screen sizes. portrait layout 240x400 320x480 400x800 I designed my main prog for 320x480 Must I manually detect scale on the device and adjust view positions and images? There must be an easier way, to automatically scale advice is needed grCor
It's not clear to me how to make a program which fits automatically to the following screen sizes. portrait layout 240x400 320x480 400x800 I designed my main prog for 320x480 Must I manually detect scale on the device and adjust view positions and images? There must be an easier way, to automatically scale advice is needed grCor
M marathon332 Member Licensed User Longtime User Dec 16, 2010 #2 What a coincidence... I just not 2 minutes ago, put this on the wishlist... http://www.b4x.com/forum/bugs-wishlist/6930-autoscale-function.html#post39975 If enough people want it, maybe we can get Erel to add it.. --Steve Upvote 0
What a coincidence... I just not 2 minutes ago, put this on the wishlist... http://www.b4x.com/forum/bugs-wishlist/6930-autoscale-function.html#post39975 If enough people want it, maybe we can get Erel to add it.. --Steve
Erel B4X founder Staff member Licensed User Longtime User Dec 16, 2010 #3 As I wrote in the post mentioned above Basic4android does scale layouts automatically. However developers are sometimes confused with the meaning of auto scale. Auto scale means that the layout is scaled based on the screen DPI - dots per inch. The ratio between the height and the width always stays the same. So if one device is longer than the other there will be an empty space at the bottom. The same layout can be used for a device with HVGA device with 320*480 (160DPI = 1.0) and WVGA device with 480*800 (240DPI = 1.5). Though you will have some empty space at the bottom. Last edited: Dec 16, 2010 Upvote 0
As I wrote in the post mentioned above Basic4android does scale layouts automatically. However developers are sometimes confused with the meaning of auto scale. Auto scale means that the layout is scaled based on the screen DPI - dots per inch. The ratio between the height and the width always stays the same. So if one device is longer than the other there will be an empty space at the bottom. The same layout can be used for a device with HVGA device with 320*480 (160DPI = 1.0) and WVGA device with 480*800 (240DPI = 1.5). Though you will have some empty space at the bottom.
agraham Expert Licensed User Longtime User Dec 16, 2010 #4 A typo there I think Erel. Erel said: The same layout can be used for a device with HVGA device with 320*480 (160DPI = 1.0) and WVGA device with 480*800 (240DPI = 1.5). Click to expand... But it won't scale on a device like my tablet with 480*800(160DPI = 1.0) so you need a separate layout to cope with this. Upvote 0
A typo there I think Erel. Erel said: The same layout can be used for a device with HVGA device with 320*480 (160DPI = 1.0) and WVGA device with 480*800 (240DPI = 1.5). Click to expand... But it won't scale on a device like my tablet with 480*800(160DPI = 1.0) so you need a separate layout to cope with this.
C Cor Active Member Licensed User Longtime User Dec 16, 2010 #5 also does not work on a scaled down 240x400 grCor Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Dec 16, 2010 #6 It shouldn't be difficult to create layout variants for many types of screens. - Create emulators with the required screen resolutions. - Design the first layout with the regular settings. - Add layout variants for each target resolution. Connect to the matching emulator and move the views as required. - If you later add a new view you will need to set its position in all variants. Therefore it is recommended to first create the "main" layout and only then add the variants. Upvote 0
It shouldn't be difficult to create layout variants for many types of screens. - Create emulators with the required screen resolutions. - Design the first layout with the regular settings. - Add layout variants for each target resolution. Connect to the matching emulator and move the views as required. - If you later add a new view you will need to set its position in all variants. Therefore it is recommended to first create the "main" layout and only then add the variants.
C Cor Active Member Licensed User Longtime User Dec 16, 2010 #7 thanks Erel, that was clear put it in documentation grCor Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Dec 16, 2010 #8 I will create a short tutorial about it. Upvote 0
C colin9876 Active Member Licensed User Dec 16, 2010 #9 Whats the command to get the screen height and screen width of the device that the codes running on? does canvas1.height return the value? (just a guess?) Upvote 0
Whats the command to get the screen height and screen width of the device that the codes running on? does canvas1.height return the value? (just a guess?)
C Cor Active Member Licensed User Longtime User Dec 16, 2010 #10 Code: Copy Dim layoutVal As LayoutValues layoutVal=GetDeviceLayoutValues If layoutVal.width < 320 Then splashPanel.SetBackgroundImage(LoadBitmap(File.DirAssets,"notsupported.png")) Activity.AddView(splashPanel, 0, 0, 100%x, 100%y) Return True End If grCor Upvote 0
Code: Copy Dim layoutVal As LayoutValues layoutVal=GetDeviceLayoutValues If layoutVal.width < 320 Then splashPanel.SetBackgroundImage(LoadBitmap(File.DirAssets,"notsupported.png")) Activity.AddView(splashPanel, 0, 0, 100%x, 100%y) Return True End If grCor
Erel B4X founder Staff member Licensed User Longtime User Dec 16, 2010 #11 GetDeviceLayoutValues: Basic4android - Core Upvote 0