Android Question Anchors, Anchors Question

Discussion in 'Android Questions' started by tdocs2, Feb 12, 2015.

  1. tdocs2

    tdocs2 Well-Known Member Licensed User

    Greetings, all.

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

    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.


    AnchorsNexus10.png AnchorsASUSTF103.png AnchorsHPSlate21.png

    PS: I tested on two additional devices with success

    Attached Files:

    Last edited: Feb 12, 2015
  2. DonManfred

    DonManfred Expert Licensed User

    The Horizontal anchor of panel PWHITE is set to LEFT. I suggest using BOTH here
  3. tdocs2

    tdocs2 Well-Known Member Licensed User

    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.

  4. NJDude

    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.
    thedesolatesoul likes this.
  5. tdocs2

    tdocs2 Well-Known Member Licensed User

    Thank you, NJ.

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

    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.

  6. NJDude

    NJDude Expert Licensed User

    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.
    thedesolatesoul likes this.
  7. tdocs2

    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:

    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:

    Best regards.

  8. NJDude

    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.
    thedesolatesoul and tdocs2 like this.
  9. tdocs2

    tdocs2 Well-Known Member Licensed User

    Clever classification.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice