I am developing smart gwt application, As per smart FAQ we have to give smart gwt component height, width in pixels.
Giving size in pixels will not behave uniform in all resolutions.
Can anybody tell how to make it resolution independent? so it behave uniform in all resolutions?
Thanks,
Punam Purohit
In SmartGWt we can specify height or width in terms of percentage or pixels. if u see in layout or canvas or any item's function will have setWidth(String width) & setHeight(String height), this string parameter will accept either pixels or percentage
values.
for ex: Vlayout.setWidth("50%") this will set 50% of screen size to that corresponding layout obj.
Refer javadoc of any SetWidth or setHeight : http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/widgets/Canvas.html#setWidth%28java.lang.String%29
I haven't used SmartGWT in a while, but I remember that most of the widgets were overloading a setWidth value which accepted %.
Anyway, the proper way should be using layouts to compose the position of your widgets.
Related
I want to create a UIView that takes up a one inch square on every iOS device. So far, I have looked up the pixel size of my current test-device and translated a CGFloat to an inch using my test-device's pixel size times its UIScreen's scale factor. Is there any clever way to use built-in information about the UIDevice to get a CGFloat that amounts to one inch across the screen when applied to a UIView's width and height? Instead of creating cases where I manually account for every possible device pixel size, then have to update it every time a new pixel size comes out, I would like to somehow figure out the pixel size using the device's characteristics.
The extension at https://github.com/marchv/UIScreenExtension works to do what I want to do by compiling data about all possible screen PPIs and comparing the UIDevice Model against them to get the CGFloat representing a centimeter of physical distance. Thanks to NobodyNada - Reinstate Monica's comment leading me to this extension by linking How to find PPI programmatically with precision.
I am accepting for now that there may not be a way to get physical distance just from the UIDevice's intrinsic properties, as another answerer to that question suggests.
Does anyone know what is the maximum width and height of a Bitmap in a FireMonkey TImageViewer?
I am drawing vector graphics in a TImageViewer. I am only able to zoom up to a certain value then I get a memory exceprion.
I've tested this on two seperate computers and it would appear that the actual size limit to a Bitmap in Firemonkey is 8000x8000 px meaning both Width and Height respectively cap at 8000 px size.
This is what I observed, if anyone gets a different result please let me know.
How you plan to get around that is up to you, I would suggest dissecting the source image into multiple parts so that neither part excedes the limit and then assign each part to a different Bitmap component(such as TImageViewer) and then make it all come together as a whole.
I am working on a BlackBerry App that has a lot of ImageButtons, LabelFields and MessageBoxes. What appears to be perfect on one screen size, seems a mess on the other. For instance, Vertical Field Managers that are neatly aligned center with LabelFields, are left/right aligned on bigger screens. Images that cover the width of the screen appear too small on larger screens. Is there some mechanism to auto-align and dynamically change images with respect to the screen size. Any ideas and documents that can help in this regard?
Here are some tips for making screens that look good on almost all devices:
Use less images. If you have to use images, use atleast 3-4 for different screen sizes. for example if you need to have an image as the screen header, use images with widths 320px, 480px and 640px. Load image depending on the width of the screen.
Do not use pixel measurements. Use point measurements instead. Most of the devices are similar in terms of physical size, whereas they have huge difference in pixel density. Using this you can have a screen which will look exactly identical on curve (320x240), bold2 (480x360) and bold 4 (640x480). If you notice, they have the same aspect ratio and similar physical size.
Do not hardcode positions. Instead use FIELD_HCENTER and DRAW_HCENTER etc for fields.
Do not use fonts with fixed pixel height. Use fixed point height instead.
If using custom fields, make sure that they can automatically expand according to device and pixel density.
I used the 9330 simulator for developing my app, and now once I put it on a blackberry bold, I've noticed that my text and images appear much smaller on the device than the simulator. Is there anyway to fix this without having to change every objects height and width? Maybe I need to use Display.getHeight() and .getWidth() more instead of hardcoding numbers?
One way I dealt with this is making the size of my elements variable. I did this by, upon loading the app, detecting the screen size and applying a multiplier that modifies my elements by a given %, the % depends on the screen size. I calculated these percentages by taking a base screen size and seeing how much the screen sized varied from one model to another, there are only 4 screen sizes I believe.
Yes, you shouldn't hardcode any number as bold and curve have differnt screen resolutions
Curve: 8800s, 8300s, 8500s, 9300s 320x240
Bold: 8900s, 9000s, 9600s, 9700s 480x360, 480x320 (Bold 9000)
You will have to change every place you used that numbers and change to gethHeight and getWidth() where needed
For the images you should scale the object, something like this:
Bitmap bitmap = new Bitmap(width, height);
yourBitmap.scaleInto(bitmap, Bitmap.FILTER_BILINEAR);
For texts you should use something like this:
LabelField field = new LabelField("TEST");
field.setFont(field.getFont().derive(Font.PLAIN, yourFontSize));
The BB OS 5.0 supports images for context menus. The API documentation says the image will be scaled to fit a square set by the height of the menu font. I find that totally unhelpful.
The only way I can explain that method of calculation is due to screen resolution and DPI. But since the 5.0 OS is only valid on a handful of devices with similar screen sizes, I reckon they can specify the actual icon size they use.
I'd like to choose an icon size that's closest to the default menu font height so that the they look OK.
What size do you use? Do you even use this feature?
I haven't used it yet, but I would recommend using any square ratio maybe up to 64x64; the problem is that with new devices on the horizon (eg rumored tablet - with much bigger display) it won't necessarily be practical to target a specific screen size.