There have been several posts regarding designing layouts for multiple screen sizes and densities. Specifying view locations in terms of %X and %Y is one such approach which will adapt to any screen. The result may not be optimized visually, but at least it should work on any device.
For most projects, I use the visual designer to layout the various views. Converting multiple views to relative positions can be quite tedious, but here is one method to speed the process (I used this method to update my ProbCalc program located in the Share Your Creations forum):
I used the visual designer to layout all of the views (I used 320 x 480 scale=1).
In Excel (or similar spreadsheet) I created a row with 5 columns containing "Name L T W H".
I then entered the name of each view along with its L T W H values.
I then added 4 more columns labeled "X Y X Y".
For each row (view) I had Excel divide each view's layout values by either X (320) or Y (480) (multiplied by 100 to yield the relative percentages).
Then using Excel's Concatenate fuction I generated the appropriate SetLayout string for each view.
Finally, I pasted these strings into my program in a sub called "ResizeViews", which is called from the sub Activity_Resume.
Because I wanted different portrait and landscape views, I repeated the process for the alternate layout.
It sounds a lot more complicated and time consuming than it really was. Inspect the attached spreadsheet and I think you will see.
For most projects, I use the visual designer to layout the various views. Converting multiple views to relative positions can be quite tedious, but here is one method to speed the process (I used this method to update my ProbCalc program located in the Share Your Creations forum):
I used the visual designer to layout all of the views (I used 320 x 480 scale=1).
In Excel (or similar spreadsheet) I created a row with 5 columns containing "Name L T W H".
I then entered the name of each view along with its L T W H values.
I then added 4 more columns labeled "X Y X Y".
For each row (view) I had Excel divide each view's layout values by either X (320) or Y (480) (multiplied by 100 to yield the relative percentages).
Then using Excel's Concatenate fuction I generated the appropriate SetLayout string for each view.
Finally, I pasted these strings into my program in a sub called "ResizeViews", which is called from the sub Activity_Resume.
Because I wanted different portrait and landscape views, I repeated the process for the alternate layout.
It sounds a lot more complicated and time consuming than it really was. Inspect the attached spreadsheet and I think you will see.