Martin Larsen Active Member Licensed User Longtime User Feb 20, 2020 #1 ActivitySize gives the approximate activity size in inches. On my Huawei P20 Pro (6") ActivitySize=5 Apart from the status bar at the top, the ActivitySize should be equal to the screen size, so why this difference? Am I misunderstanding ActivitySize? Also, why is ActivitySize not the same in the wysiwyg designer on my phone and in the actual app running on the phone? In the wisywyg designer ActivitySize = 4.78 I show the value using lblActivitySize.text = ActivitySize
ActivitySize gives the approximate activity size in inches. On my Huawei P20 Pro (6") ActivitySize=5 Apart from the status bar at the top, the ActivitySize should be equal to the screen size, so why this difference? Am I misunderstanding ActivitySize? Also, why is ActivitySize not the same in the wysiwyg designer on my phone and in the actual app running on the phone? In the wisywyg designer ActivitySize = 4.78 I show the value using lblActivitySize.text = ActivitySize
Erel B4X founder Staff member Licensed User Longtime User Feb 20, 2020 #2 Martin Larsen said: Apart from the status bar at the top Click to expand... Apart from the status bar, the bottom navigation bar and the title bar. Martin Larsen said: Also, why is ActivitySize not the same in the wysiwyg designer on my phone and in the actual app running on the phone? In the wisywyg designer ActivitySize = 4.78 Click to expand... The exact numbers are not important. You shouldn't create a layout for any specific size. The difference might be related to different settings of full screen and title bar. Upvote 0
Martin Larsen said: Apart from the status bar at the top Click to expand... Apart from the status bar, the bottom navigation bar and the title bar. Martin Larsen said: Also, why is ActivitySize not the same in the wysiwyg designer on my phone and in the actual app running on the phone? In the wisywyg designer ActivitySize = 4.78 Click to expand... The exact numbers are not important. You shouldn't create a layout for any specific size. The difference might be related to different settings of full screen and title bar.
Martin Larsen Active Member Licensed User Longtime User Feb 20, 2020 #3 Erel said: Apart from the status bar, the bottom navigation bar and the title bar. Click to expand... I haven't got any of them. There is no title bar and I use gestures for navigation. Upvote 0
Erel said: Apart from the status bar, the bottom navigation bar and the title bar. Click to expand... I haven't got any of them. There is no title bar and I use gestures for navigation.
Erel B4X founder Staff member Licensed User Longtime User Feb 20, 2020 #4 Are you hiding the soft buttons = immersive mode? Upvote 0
Martin Larsen Active Member Licensed User Longtime User Feb 20, 2020 #5 Erel said: Are you hiding the soft buttons = immersive mode? Click to expand... No, not explicitly but I don't use soft buttons at all. I use gestures, that is swiping from the edges and bottom etc. Erel said: The exact numbers are not important. You shouldn't create a layout for any specific size. Click to expand... I know. I use it for making minor adjustments for small screens: B4X: If ActivitySize < 5 Then ' do something End If Upvote 0
Erel said: Are you hiding the soft buttons = immersive mode? Click to expand... No, not explicitly but I don't use soft buttons at all. I use gestures, that is swiping from the edges and bottom etc. Erel said: The exact numbers are not important. You shouldn't create a layout for any specific size. Click to expand... I know. I use it for making minor adjustments for small screens: B4X: If ActivitySize < 5 Then ' do something End If
Erel B4X founder Staff member Licensed User Longtime User Feb 20, 2020 #6 Martin Larsen said: No, not explicitly but I don't use soft buttons at all. Click to expand... It doesn't matter. If they are visible then they will make the activity a bit shorter. Upvote 0
Martin Larsen said: No, not explicitly but I don't use soft buttons at all. Click to expand... It doesn't matter. If they are visible then they will make the activity a bit shorter.
Martin Larsen Active Member Licensed User Longtime User Feb 20, 2020 #7 You misunderstand me. (Or I misunderstand you!) They are not visible, they are simply not there! LINK: Gesture navigation Last edited: Feb 20, 2020 Upvote 0
You misunderstand me. (Or I misunderstand you!) They are not visible, they are simply not there! LINK: Gesture navigation
Erel B4X founder Staff member Licensed User Longtime User Feb 20, 2020 #8 Anyway, activity size is calculated like this: Code: Dim Scale As Float = GetDeviceLayoutValues.Scale Dim ActivitySize As Float = Sqrt(Power(100%x / Scale, 2) + Power(100%y / Scale, 2)) / 160 Log(ActivitySize) The scale is approximated. You can also get the "exact" scale value (set by the manufacturer), however all this discussion is missing the main point - you shouldn't try to target any specific screen size. Use anchors and designer script and build a layout that adopts to all screens. Upvote 0
Anyway, activity size is calculated like this: Code: Dim Scale As Float = GetDeviceLayoutValues.Scale Dim ActivitySize As Float = Sqrt(Power(100%x / Scale, 2) + Power(100%y / Scale, 2)) / 160 Log(ActivitySize) The scale is approximated. You can also get the "exact" scale value (set by the manufacturer), however all this discussion is missing the main point - you shouldn't try to target any specific screen size. Use anchors and designer script and build a layout that adopts to all screens.
Martin Larsen Active Member Licensed User Longtime User Feb 20, 2020 #9 Erel said: Use anchors and designer script and build a layout that adopts to all screens. Click to expand... That's what I do but I still need to decrease some paddings on small screens. And I actually got the idea from one of your posts. It doesn't matter so much that the returned size is not correct, I have just adjusted the comparison accordingly. I just wondered why there was such a big difference. Upvote 0
Erel said: Use anchors and designer script and build a layout that adopts to all screens. Click to expand... That's what I do but I still need to decrease some paddings on small screens. And I actually got the idea from one of your posts. It doesn't matter so much that the returned size is not correct, I have just adjusted the comparison accordingly. I just wondered why there was such a big difference.