Android Question Anchors, Anchors Question

tdocs2

Well-Known Member
Licensed User
Greetings, all.

I believe this is not a trivial question. I appreciate and welcome any and all responses.

Question:
Why is the Anchors app that I zipped and attach behaving differently in one device?

I am attaching 3 screenshots from 3 devices with different resolutions - 2 successful and one failure:

1. Nexus10 - 2560 X 1504 scale=2.0. Android 5 - Success
2. ASUS TF103 - 1280 x 752 scale = 1.0 Android 4.4. - Success
3. HP Slate 21 - 1920 x 1034 scale 1.0 Android 4.3 - Failed (It scales well vertically, but not horizontally - note the black background to the right of the white Panel).

Best wishes.

Sandy

AnchorsNexus10.png AnchorsASUSTF103.png AnchorsHPSlate21.png

PS: I tested on two additional devices with success
 

Attachments

Last edited:

tdocs2

Well-Known Member
Licensed User
The Horizontal anchor of panel PWHITE is set to LEFT. I suggest using BOTH here
Hello, Don.

I was hoping to hear from you on this one because of your expertise in this area...

I had tried your suggestion already but that only aligns the PWhite panel. The rest of the panels do not. Look at the widths and heights of all the panels in all of the screenshots for the 3 tablets. I have no clue why it does not work on the HP Slate 21 (and ergo I suspect that it will not work on the new HP 17 which are also 1920 by 1080). It works perfectly on a Matricom MX box feeding a 1920 by 1080 monitor via HDMI...

Of course, this app is only a mock up to illustrate the problem in the HP Slate 21. The real app contains TableViews inside the panels which exhibit the same problem. I do not know why the layout does not scale properly on the HP21 while it scales perfectly on all other devices.

Help please.

Best regards.

Sandy
 

NJDude

Expert
Licensed User
You cannot rely on anchors alone, you will have to also use the designer scripts, looking at your code, you are doing it wrong, you should use a 480x320 variant (since your app is in landscape), that being said, it also depends on your layout, meaning, anchors might not work, but the scripts always do, there's no perfect method or "magic" way, like I said previously, depends on your layout.
 

tdocs2

Well-Known Member
Licensed User
Thank you, NJ.

you should use a 480x320
Question: Why must I use the minimum variant 480 by 320? My target is 1280 by 800 minimum.

but the scripts always do
You are correct in this area. By adding scripts, I could increase the control of the layout of the views included in the Designer only. By adding code to the app, I could increase control not only of the views in the layout in the Designer but also for any views added.

@@@@@@@

CASE: Add code to the app to control views in the Designer Layout and those added in code.

The question remains, why is the behavior on the HP Slate 21 different that all the other environments I tried? Why is the PWhite panel width 1582 as opposed to 1280 (scale=1) or 1920 to match the Device Layout as the case was with all other devices I tried? What factor is driving what seems to be this arbitrary scaling? If I had an answer to this question, then I could program to achieve the desired results.

@@@@@@@

Best regards.

Sandy
 

NJDude

Expert
Licensed User
Question: Why must I use the minimum variant 480 by 320? My target is 1280 by 800 minimum.
The 480x320 variant is the base variant, so, regardless of the size of the screen, the layout will scale properly, if you set 1280x800 anything slightly smaller will not scale properly, I would suggest you redo your layout using 480x320 and you will see what I'm walking about.
 

tdocs2

Well-Known Member
Licensed User
Thank you, NJ.

I understand what you are saying. My app just will not realistically run on small devices - too many views, etc. I planned to restrict the target market by including in the manifest file:

B4X:
android:requiresSmallestWidthDp="1200"
I have to experiment with this when I am on an alpha stage in Google Play since I do not know whether is the portrait width that should be indicated. To go to the minimum variant, I have to change many layouts that I have done, add panels and then add layouts to them... I have been working on this app for some time... If I were starting over, I would consider that path - it might be the best way.

I am still at a loss for the other part of the question:

@@@@@@@

CASE: Add code to the app to control views in the Designer Layout and those added in code.

The question remains, why is the behavior on the HP Slate 21 different that all the other environments I tried? Why is the PWhite panel width 1582 as opposed to 1280 (scale=1) or 1920 to match the Device Layout as the case was with all other devices I tried? What factor is driving what seems to be this arbitrary scaling? If I had an answer to this question, then I could program to achieve the desired results.

@@@@@@@
Best regards.

Sandy
 

NJDude

Expert
Licensed User
The only thing I can tell you is that it's better to work with designer scripts and percentages, that way you avoid that some device with a weird size or density misbehaves, depending on the complexity of your layouts might be a little tedious but you will know for sure that it will work, otherwise, get ready for "1 star ninjas" complaining that your app doesn't look good on their devices.
 
Top