Android Question Samsung Tablet GT-P3100 Android 4.2.2

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi to all
I am not able to use the Designer connected via Usb to the above mentioned tablet. I mean: connection works etc., ( connecting and adapting to connected device), but the layout saved is not correctly displayed at runtime. Any one has experience on this?
Thanks in advance
 

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi, Thanks for replies. The situation is rather simple to describe. I connect the tablet vie Usb, having enabled this possibility on the Android options of the tablet (under Programmer's options). Then:
1) Open a project
2) Open Designer
3) Press WYSIWYG and Connect
4) A blank page appears on tablet
5) On computer, on right panel of designer, I press (Adapt to connected device; I translate from Italian, the original option name may be different)
6) I put views; their position is same on Designer on computer and tablet
7) Executing the App, positions are wrong.
The attached pictures show the process. For example the button on bottom disappears.
Since when I got first version of B4A, many years ago, I had this problem.
Almost for sure it happens also with B4aBridge.
Thanks for attention
 

Attachments

  • DesignerOnComputer.jpg
    DesignerOnComputer.jpg
    52.7 KB · Views: 200
  • DesignerOnDevice.jpg
    DesignerOnDevice.jpg
    65.2 KB · Views: 204
  • AppExecution.jpg
    AppExecution.jpg
    63.4 KB · Views: 188
Upvote 0

udg

Expert
Licensed User
Longtime User
Could it be a wrong setting with anchors? Try setting "bottom" as vertical and "both" as horizontal for the button placed at the bottom; does it appear when you launch the app?
 
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi. It is not a problem of anchors. As I said, the problem is that there is no correspondence between the designer and the App, when executed. It is a general problem. By the way, for example, anchoring to the bottom makes the view disappear. It is like that, while designer works properly, the app uses a bigger screen size, so the views positioned on right and bottom are cut or disappear. Thanks for reply.
 
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Actually I was talking about Designer/App correspondence, not about anchors. Anyway I will check my layout, if this is a solution. Thanks.
 
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
In the attached project, I have done a simple layout, named "2". I have put some views, as shown in the picture. The top-right edittext is anchored to the top-right, while the bottom Button is anchored to the left-bottom. (In project I also have a layout "3" not used, forget about). Pictures show positions in Designer. Executing the App, both top-right edittext and bottom button are not shown. I attach also a picture of the App, despite it is not very clear, due to light reflection. Unluckily I don't see my mistake, that I did, for sure.
 

Attachments

  • TestPosition.zip
    10.8 KB · Views: 203
  • app.jpg
    app.jpg
    55.4 KB · Views: 191
  • designer.jpg
    designer.jpg
    85.4 KB · Views: 202
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
By the way, while in the previous project I loaded the layout in a Panel, I did now an experiment loading the layout in the activity. The views now appear. Therefore my problem is on using a xuiPanel. In the previous project I used SetLayoutAnimated with 95%y size., but the vertical size is not the problem. Also setting 100%y the behavior is the same. Still positions in the designer and in the App don't correspond ( I suppose that vertical size is not the same). Of course with anchors it is possible to mitigate this effect and resolve many cases, I guess. As I already said, my question was not on anchors. Thanks for attention.
 
Upvote 0

udg

Expert
Licensed User
Longtime User
One thing:
pan.SetLayoutAnimated should occur before pan.loadlayout
Try with:
B4X:
Dim pan As B4XView = xui.CreatePanel("")
pan.SetLayoutAnimated(0, 2dip, 0, 100%x, 95%y) '11*(deltay+3))
pan.LoadLayout("2")
Maybe 95% is too high, but keep it for now just to see the difference. As for layout "2" try the one attached here and keep modifying it to suit your needs.
 

Attachments

  • 2.bal
    3.1 KB · Views: 216
Last edited:
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
YES. The mistake is in the order of the instructions: setLayoutAnimated must be issued before loading the Layout. This solves everything. Many Thanks.
 
  • Like
Reactions: udg
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi. At the end, the reason of my problem is that there is an instruction on the Scripts Panel of the designer. For some reason (Perhaps it is the default) there is an "Autoscale All" instruction. This makes the difference. I don't use scripts and didn't care about this detail. When using the Designer connected via Usb (or in another way, I guess), that instruction must be commented out and the correspondence between Designer and App is correct. This, at least, is my conclusion.
 
Upvote 0
Top