I have made an app that has in total 62 buttons, textboxes, imageviews, labels, etc which was written as Scale 1.0 on a 320*480 emulator
The app is running like it should however when I loaded it onto a Galaxy mini which has a smaller screen size than the Standard Screen size the app was too large for the screen
I then read the tut regarding resizing which seems to suggest that I will need to write code for each button etc in order for them to resize according to the screen size
I trialed the tut and resized the panels and although the panels did resize and the buttons etc appeared to move correctly the top of the panel docked half way down the activity
My question is:
a) am I right in thinking that I need resize each button etc
b) my app has 5 panels. Am I able to simply resize them (If so how)
I know I can add a variant in the designer but that is all I understand
I have seen in the abstract designer under layout there is an option named match chosen variant and another named match connected device but what does that actually mean
to center on the screen:
button.Left = (screenX - button.Width) / 2
button.Top = (screenY - button.Height) / 2
The only thing to account for is if the device has a soft menu in which case I subtract 50dip from the height before scaling
I don't know if this is the most efficient way of doing things (I'm sure Erel has better) but my layout appears the same regardless of the screen size or the device.
I was hoping to fill the screen regardless of screen size
I am guessing that mc73 solution would require me to make a layout for every layout size which also requires a lot of work in which case it would be a coin toss between designer layout and code layout
I use percentages myself. I tend to think of it like an excel sheet or html table. Layouts only seem to work for very simple screens from what i've tried myself. The designer can work as long as you don't need to scroll around i guess.
I determine what 100%x is by throwing it into a variable, then divide accordingly by how much width each item is. Height works similarly. If all buttons use the same columns (like square tiles) then it's pretty easy and you can use one set of variables. If the number of items in each grid row changes then you'll have to calculate them row by row to figure out the correct placement. They key though is not to use raw numbers, use percentages. In fact, if you do it in an html editor (set the table with to 100% before you start) you'll have the exact values needed
Here's a small sample mixing staticly sized objects with dynamically sized. (a combox anchored to left,top,right, and a button that never changes size.)
p1 is a panel
cContactList is a spinner/combobox
b1 is a button
I use percentages myself. I tend to think of it like an excel sheet or html table. Layouts only seem to work for very simple screens from what i've tried myself. The designer can work as long as you don't need to scroll around i guess.