tags:

views:

32

answers:

1

how i can make a list on canvas in an application having more then 5 to 10 pages ? and i have different no of option(list items ) on each page and i want to print the list on different SCREEN SIZES with the condition that the list print with having the same(equal) height above the top option and below the lowest option. Thanks in advance.

+1  A: 

Canvas has a getHeight() and getWidth() method you can use to dynamically change the gui, just use these to create buttons.

for example:

item 1= 0, 0, getWidth(), getHeight() / 3

item 2= 0, getHeight() / 3, getWidth(), getHeight() / 3

item 3= 0, (getHeight() / 3) * 2, getWidth(), getHeight() / 3

These would the the coordinates for three boxes evenly taking up the whole screen.

hope this helps

Steven Knox
such of code i have tried but not fullfil the requir ment properly.
ManMohan
well as far as I'm aware this is as adaptive as you can get, I use this with my 2 phones one's a new HTC with a large touch screen and one's and old Nokia with a standard screen and key pad. If anyone else has another way I'd love to see it myself.
Steven Knox
your logic is nice but it is a static one if i have only two option then the position of top option will print at the same place whether i have 5,6,7,..... options. my requirment is that"the space from above of the top optiion should be same as the space below the lowest option is.(+5 or -5 pixeles can be tollerated).thaks for your +ve response.
ManMohan
According to your code the top optiion will always printed at the 0th coordinate it is independent of the number of options these are veriable at the each pages as i mentained in my question.
ManMohan
The Coordinates are an example of some of my stuff to show how getHight and getWidth are used, they weren't meant to be a direct solution to your problem as I try never to give copy and paste-able code out anywhere. If your list is a dynamic size then all you would have to do is change the variables witch act upon the methods depending on how many things are in your list as well as a standard buffer for the first and last items if you need space before and after this list.
Steven Knox
yeha i also did so but i want some thing different which does,t depend upon the page option. the code read the no of option and then adjuest itself according to the number of option on that particular page.If the class is used for different application then these particular values we will have to change manually.that i dont want in my application. Mr Steven Knox very very thaks to you for your response. if you find any other ans regarding above plz send me i heartly well come your ans once again thanks
ManMohan