I, like a lot of others have battled with the problem of the many screen sizes and densities in Android. I saw somewhere that if you use designer scripts with percentages of the variant size as for height, width and x,y positions then it should work on all screen sizes. This can be a bit of a chore if you have lots of views so I set out to make a tool (in B4j) to do the calculations for me. It got a little more complex than I originally planned but it seems to work so far. The accuracy is ok but I am working on getting it a little bit better. It uses sqllite to save it all. It is fairly straight forward the important thing is when you enter the view name that it is entered accurately as this is used in the script. I have set it to use the standard 320 x 480 variant(portrait) and 480 x 320 (landscape) as the default I may add ability to use different sizes later you can either use the script for all variants if you have a simple layout or you can create a script for portrait and landscape and put the script in variant specific section.
All you do is create the layout as you want (one variant for portrait and one for landscape) and then use this tool and enter all the views width, height, left, top for that layout the script is created and you copy and paste it in the designer.
I did a couple of small videos(no audio) showing usage at:
https://tremara1.tinytake.com/sf/ODE1MzdfNTYyNDYz
https://tremara1.tinytake.com/sf/ODE1NDlfNTYyNTY5
The download is here : https://www.dropbox.com/sh/m28uwc69wc37ucm/AADmqCZ8GH5DIR8_S-ethgCUa?dl=0
I will upload the b4j project when I have cleaned up my code and commented it.
Very early in development so I would be careful and work with copies of your important projects to see how it works.
There is some rubbish data in the app I used for testing.
All you do is create the layout as you want (one variant for portrait and one for landscape) and then use this tool and enter all the views width, height, left, top for that layout the script is created and you copy and paste it in the designer.
I did a couple of small videos(no audio) showing usage at:
https://tremara1.tinytake.com/sf/ODE1MzdfNTYyNDYz
https://tremara1.tinytake.com/sf/ODE1NDlfNTYyNTY5
The download is here : https://www.dropbox.com/sh/m28uwc69wc37ucm/AADmqCZ8GH5DIR8_S-ethgCUa?dl=0
I will upload the b4j project when I have cleaned up my code and commented it.
Very early in development so I would be careful and work with copies of your important projects to see how it works.
There is some rubbish data in the app I used for testing.
Last edited: