1) You can check if Activity.Height > Activity.Width then it is in portrait mode. But if your concern is what layout the system should use you don't need it the OS does it, see below.
2) You can define two layout variants in a same layout file, one for portrait and one for landscape. You'll find an exampe in chapter 8.6 Layout variants in the Beginner's Guide.
3) Don't worry about that, the OS does it for you. It takes the layout that best fits the current conditions. If you have a layout file with two layout variants, portrait and landscape, the OS will take the right one.
Best regards.
Yes.1) Add a variant and rerrange the activity with the new layout.
2) the OS choose automatically the right layout
Yes, you need to define the layout with the resolution and density of the tablet like for the other resolutions. It could be interesting to have two layout files, one for smartphones and one for tablets because of the screen size difference. As tablets have a bigger screen you can put more views on it than on a smartphone screen. But in this case it's up to you to tell the system what layout file to load. The choice of one or several layout files depends on the number of views per 'page (screen)', number 'pages' etc. and your feeling. You should also have a look at the Documentation Wiki.1) If add 2 "tablet" layout (ex. 10" horizontal and landscape) and rearrange layout for this layout, the OS if on a tablet, use these layouts or not?
You can setup different Emulators, one for each resolution. You can change the orientagen of the Emulator with Ctrl+F11.2) How I can test with emulator all layouts?
Yes, you need to define the layout with the resolution and density of the tablet like for the other resolutions. It could be interesting to have two layout files, one for smartphones and one for tablets because of the screen size difference.
You can setup different Emulators, one for each resolution. You can change the orientagen of the Emulator with Ctrl+F11.
Best regards.
No, not necessarily.But you mean code a new app specifically for tablet?
You can have two layout files and in the code (one code for all) select the right layout file. If there are too many differences for the 'page' (screen) updates having two different applications could also be a solution, but probably less convenient for maintenance. This depends on the complexity of the application.Or what to do the 2 layouts?
No, not necessarily.
You can have two layout files and in the code (one code for all) select the right layout file. If there are too many differences for the 'page' (screen) updates having two different applications could also be a solution, but probably less convenient for maintenance. This depends on the complexity of the application.
Best regards.
Yes, perhaps also the density. It seems that there do exist smartphones with a resolution of 480/800 density 240 and 7'' tablets with a resolution of 480/800 but density 160.You mean: test the Layout dimension (with or height) and do the right Activity.LoadLayout ?
Yes, perhaps also the density. It seems that there do exist smartphones with a resolution of 480/800 density 240 and 7'' tablets with a resolution of 480/800 but density 160.
Best regards.
The physical width and heights of a screen with 480/800 pixels density 160 are 1.5 bigger than those of a screen with 480/800 pixels density 160.
So you can put more views with same physical dimensions on the 160 density screen.
Let's take an example:
A Button with a size of 150dip * 60dip has a size of:
density 160: 150 * 60 pixels
density 240: 225 * 90 pixels
but with almost the same physical dimensions.
On a 480/800*240 screen you can put 2 buttons side by side,
but on a 480/800*160 screen you can put 3 buttons side by side.
Best regards.
Yes, that's why I wrote that it could be intersting to have two applications one for smartphones and one for tablets, depending if you want to put more views on the big screen.Interesting but very complicated to manage...
The dimensions in the Designer are dips (density independant pixels).The unit dimensions for views (label, button) defined by gui with designer about height and withd are dpi and not pixels?
Attention, the phyical button sizes are the same, not the screen sizes.In your example with 2 device wich different dpi but same dimensions, the button appear differently?
Attention, the phyical button sizes are the same, not the screen sizes.
Best regards.
Yes, the only problem that you could have is the screen size of your computer to show the whole Emulator size.
Best regards.
Yes, that's why I wrote that it could be intersting to have two applications one for smartphones and one for tablets, depending if you want to put more views on the big screen.
Ok so I do 2 different app. One for phones, another for tablets.
The commons dpi i see in wiki, but specifically for device where i can find?
For the record, I am just a bug at the feet of Klaus in terms of B4A knowledge, but creating separate apps for phones and tablets sounds to me like asking for trouble (in my humble opinion).
You mentioned looking at the Wiki, but it shows code explaining how to use layouts for different size and density devices (phones to tablets) in the same app. Does that not work for you?
The Wiki also refers you to this post for an example of how to adjust layouts for slightly different device resolutions, so you do not need to create a different layout for the exact sizes and dpi of each device.
The choice should be the difference betweenYou can have two layout files and in the code (one code for all) select the right layout file. If there are too many differences for the 'page' (screen) updates having two different applications could also be a solution, but probably less convenient for maintenance. This depends on the complexity of the application.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?