grid vs layout based widget toolkits - layout

grid only widget toolkits (like Cocoa Touch) vs layout based toolkits (like Swing or gtk+)
iOS Cocoa Touch, being only grid based, had to port all applications when the screen resolution was upgraded (iPhone4) or enlarged (iPad)
If you could choose what would you use?

If I were designing for a platform where screen sizes could vary, I'd use a layout manager based toolkit. However if I could garuntee the same screen resolution and screen size, I'd choose to use a grid based toolkit, as it would mean I wouldn't need to think about all the logic that goes into making a layout manager based UI.

Related

Kivy : How to manage different viewports

I am trying to build a game on Kivy that will be working on desktop and on mobile. I am really confused by how i should manage different window sizes, if i set a fixed size on my widgets.
How would someone go to design a game so that every element is "responsive" to screen size, with a similar rendering on all of the devices?
Can you point me to some Kivy api reference, or give me some code samples to learn from?
Thanks!

PyQt - Adjusting for Different Screen Resolution [duplicate]

This question already has answers here:
PyQt GUI size on high resolution screens
(3 answers)
Closed 3 years ago.
I've developed an application using PyQt on a computer that has a resolution of 3840x2160. I used QtDesigner to create almost all of my UI needs, then added the few other things I needed manually in python. Once I went to deploy the application, I realized that the target computer had a resolution of 1920x1080. Some widgets in the application (generally those that just had text/buttons) are fine, but once I start to get in to more complex layouts things don't appear as clearly. Specifically, QLabels and other QItems overlap each other, images are scaled disproportionately along their horizontal axis, and spacing between objects decreases. The following are a couple of images that illustrate the problem.
3480x2160 Screen (250% Scaling according to Windows Scale and Layout)
Note: This is what I see when I am developing.
3480x2160 Screen (100% Scaling according to Windows Scale and Layout)
1920x1080 Screen (100% Scaling according to Windows Scale and Layout)
I also noticed that Qt Designer itself has a similar problem when transitioning to a different screen resolution (see images attached).
High Resolution Screen - QtDesigner
Lower Resolution Screen - QtDesigner
What is the proper way to go about dealing with multiple screen resolutions in PyQt if I want to leverage QtDesigner? I know that I can retrieve the screen resolution with QDesktopWidget.screenGeometry, but is there any way to scale every parameter at once rather than manually changing each item? Will avoiding a particular "Size Policy" help at all with this?
If the issues is more with different dpi than resolution, you can tell Qt to use high dpi scaling/pixmaps by adding the following lines to your application before you create your QApplication (or any other Qt classes):
# Handle high resolution displays:
if hasattr(QtCore.Qt, 'AA_EnableHighDpiScaling'):
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)
if hasattr(QtCore.Qt, 'AA_UseHighDpiPixmaps'):
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)
I have found that this makes my applications behave the same (or at least more similar) when switching between my laptop (high dpi, high resolution) and desktop (normal dpi, 1920x1080).
I don't use QtDesigner, so I have no idea how this suggestion plays with QtDesigner.

Responsive Grid Implementation in Xamarin.Forms

What would be the right way to create a responsive fluid grid in Xamarin.Forms? In the CSS world, this can be accomplished by using inline-block divs or flexboxes. What is the equivalent in Xamarin.Forms? (I don't consider checking screen sizes programatically and changing the column number as a responsive solution but rather an adaptive one as in media queries.)
Unfortunately, there is no equivalent in Xamarin.Forms.
You have to query the device type and/or the screen-resolution maybe also the device orientation an then implement different layouts for phones and tablets and/or device orientation, if you want to optimize your app.

How to apply layout constraints to in windows phone 8.1?

How can I apply layout constraints to layout so that it auto adjusts it self for every device like we apply in iOS?
The app I developed leaves blank spaces when I run it on higher size devices.
There are several techniques you can use. Which is best depends on your app's specific design:
Use a fluid control such as GridView or ListView which will expand to fill the available space.
Use a relative size layout control such as a Grid to lay things out by percentages.
Use Visual States to choose different controls or layouts for different size or aspect ratio screens
Use a ViewBox to stretch a layout to fit
Windows 10 adds a few new controls that can help:
RelativePanel to specify control locations relative to other controls (on top off, to the left of, etc.)
Adaptive triggers to automatically switch Visual States based on window size changes
See Defining layouts and views on MSDN for details and quickstarts.
There were several sessions at Build 2015 which touched on this subject, although more aimed at Windows 10 capabilities than at Windows Phone 8.1

Supporting multiple screen sizes/resolutions/aspect ratios using MonoGame

What is the recommended way of supporting multiple screen resolutions/aspect ratios across devices like iPad, iPhone, Windows Phones, and Android phones/tablets? Should I simply #if/#else specific code for each device? I don't know how well this would work. Especially for Android phones/tablets which come in all different sizes. Any pointers would be greatly appreciated.
Here is what we are doing for our game:
All menu or ui elements are positioned based on the screen size (we implement Horizontal and Vertical alignment)
All levels scroll, so on some devices you just see less of level of the level at a time
Our levels also zoom in on smaller devices where needed
Design fixed levels (ones that don't scroll) so that a bit of unused space is on the edges of the screen. This way it can get cropped on some devices no problem.
Make 3 sizes of images: small (3GS), medium (iPhone 4, Android, WP7, iPad), large iPad3
Position sprites/ui elements based on an images size
Take advantage of the #2x naming scheme for images
We made an iPhone-only and iPad-only version of the app, this helps in only having to put 2 sets of images in each app
Using the screen size for positioning is your best bet. Being able to center or dock to the bottom or right of the screen is also very helpful in general.
I could tell more, but I can't reveal specifics about our game yet.

Resources