J junaidahmed Well-Known Member Licensed User Longtime User Jul 31, 2011 #1 I have Created a layout with 600 X 1024.Can I Change the position of all view that fit on 480 X 800 in runtime (i.e) dynamically change the position depends upon screen size.pls advise and post the example code
I have Created a layout with 600 X 1024.Can I Change the position of all view that fit on 480 X 800 in runtime (i.e) dynamically change the position depends upon screen size.pls advise and post the example code
Cableguy Expert Licensed User Longtime User Jul 31, 2011 #2 Check the Activity.width value on Activity.Resume and set the views position according to that value returned... Something like: Code: Copy Sub Activity_Resume Select Activity.Width ' Or Height, wich is easier for you Case 320 '320x480 screen 'position the views here Case 480 '480x800 screen 'position the views here ...... End Select End Sub You should also take into attencion that resume is called also when the device is rotated, so you should as well test for that...like: Code: Copy Case 480 If Activity.Height =800 Then ' this is a 480x800 in portrait 'position the views Else ' this is in landscape 'position the views End If Upvote 0
Check the Activity.width value on Activity.Resume and set the views position according to that value returned... Something like: Code: Copy Sub Activity_Resume Select Activity.Width ' Or Height, wich is easier for you Case 320 '320x480 screen 'position the views here Case 480 '480x800 screen 'position the views here ...... End Select End Sub You should also take into attencion that resume is called also when the device is rotated, so you should as well test for that...like: Code: Copy Case 480 If Activity.Height =800 Then ' this is a 480x800 in portrait 'position the views Else ' this is in landscape 'position the views End If