aaronk Well-Known Member Licensed User Longtime User Aug 11, 2012 #1 Hello, I am trying to load a Layout based on if it's a Phone or a tablet. As you know tablets have a bigger screen than a phone and I want to load a different Layout based on the screen size. I know how to load a layout by using the following code: Code: Copy Activity.LoadLayout("Layout_Name") I also know you can create a design script to move the objects based on percentage etc.. however what is the best way to detect what screen size the user is using, so I know what layout to show? Is there a easy way to tell if a user is using a phone, 7" tablet or 10" tablet ? If so, what is the best code to use to detect the screen size etc.
Hello, I am trying to load a Layout based on if it's a Phone or a tablet. As you know tablets have a bigger screen than a phone and I want to load a different Layout based on the screen size. I know how to load a layout by using the following code: Code: Copy Activity.LoadLayout("Layout_Name") I also know you can create a design script to move the objects based on percentage etc.. however what is the best way to detect what screen size the user is using, so I know what layout to show? Is there a easy way to tell if a user is using a phone, 7" tablet or 10" tablet ? If so, what is the best code to use to detect the screen size etc.
NJDude Expert Licensed User Longtime User Aug 11, 2012 #2 I also know you can create a design script to move the objects based on percentage etc.. however what is the best way to detect what screen size the user is using, so I know what layout to show? Click to expand... If you are using the designer scripts there's no need to detect if the device is a tablet or a phone, the script will automatically adjust the layout to the size of the screen, however, you can design a layout for portrait and another for landscape, in case you app supports both orientations. Is there a easy way to tell if a user is using a phone, 7" tablet or 10" tablet ? Click to expand... Yes, look at THIS code. Upvote 0
I also know you can create a design script to move the objects based on percentage etc.. however what is the best way to detect what screen size the user is using, so I know what layout to show? Click to expand... If you are using the designer scripts there's no need to detect if the device is a tablet or a phone, the script will automatically adjust the layout to the size of the screen, however, you can design a layout for portrait and another for landscape, in case you app supports both orientations. Is there a easy way to tell if a user is using a phone, 7" tablet or 10" tablet ? Click to expand... Yes, look at THIS code.
aaronk Well-Known Member Licensed User Longtime User Aug 12, 2012 #3 Hello, Thanks for pointing me to the post which helps heaps.. I am now using the following code, but is there a way to detect if it's a 7" or 10" tablet ? Code: Copy If GetDevicePhysicalSize > 6 Then '7'' or 10'' tablet Else 'phone End If Upvote 0
Hello, Thanks for pointing me to the post which helps heaps.. I am now using the following code, but is there a way to detect if it's a 7" or 10" tablet ? Code: Copy If GetDevicePhysicalSize > 6 Then '7'' or 10'' tablet Else 'phone End If
NJDude Expert Licensed User Longtime User Aug 12, 2012 #4 Just change the query: Code: Copy If GetDevicePhysicalSize = 7 Then '7 inch tab ... If GetDevicePhysicalSize = 10 Then '10 inch tab You can play with those results since you might not get exactly 7 or 10. Last edited: Aug 12, 2012 Upvote 0
Just change the query: Code: Copy If GetDevicePhysicalSize = 7 Then '7 inch tab ... If GetDevicePhysicalSize = 10 Then '10 inch tab You can play with those results since you might not get exactly 7 or 10.