Android Question Problem with responsive layout by designer scripts

milanjo

Member
Licensed User
Longtime User
Hello,

I want to make my layout responsive.
First I'd make my design to fit perfectly to my tablet screen.
Then I want to make it responsive by setting how much % it should have for example if editbox should have width 300px and my screen width is 600 - I will setup in designer scripts myeditbox.width = 50%x
etc. so I had written to the paper following proporties of each of my elements:

Left Top Width Height

And calcute % values. Then I make my designer script like:

firstelement.left = somenumber%x
firstelement.top = somenumber%y
firstelement.width = somenumber%x
firstelement.height = somenumber%y
secondelement.left = somenumber%x
........ etc.

When I comment my designer scripts and there will be only AutoScaleAll - In normal mode my layout width is only maybe 70% of tablet screen but if I switch into the designer script mode (there's only AutoScaleAll option) and run it layout width is equal to my tablet width - as it should be.
So why in normal (not designer) mode layout width is only about 70% of my tablet screen width ? (There's a same problem with height too).

And when I try to run my responsive designer script (as shown up) in the designer mode will layout have again only about 70% of real tablet screen width & height.
When I run my final app, the app will also consume only 70% of tablet real width & height.

Where's the problem ?

Thank's you very much for help, hope you understand me. My app zipped in attachment.
 

Attachments

  • bluetoothapp2.zip
    403.2 KB · Views: 248

Erel

B4X founder
Staff member
Licensed User
Longtime User
You shouldn't use percentage to create a responsive layout.
Use anchors. It is much more simpler and powerful:

SS-2016-01-04_08.23.33.png



SS-2016-01-04_08.23.52.png


Only leave the AutoScaleAll call.
 
Upvote 0

milanjo

Member
Licensed User
Longtime User
Than you for your quick answer.You really help me.

Everything works exactly as I want since I redesigned my app with anchors.

Also I realised that my solution with % work good too but I must comment AutoScaleAll and multiple each % value by 1.3 for example (firstelement.left = somenumber%x * 1.3).

Thank you very much for support. Thread can be closed now.
 
Upvote 0

milanjo

Member
Licensed User
Longtime User
It worked on every device listed in abstract designer + on my device - so i thought it will work everywhere. (I know that for scale rate I should calcute delta and that way apply that value) - but it doesn't matter I used anchors method.
 
Upvote 0

Pilar-JLSineriz

Active Member
Licensed User
Longtime User
Hi Erel

I have a problem. My first design is for a resolution 1600x2560, and now I want to change 1536x2048, and logically I don´t have place in the new design for all the controls. (First figure, the first design, and second figure, the second design).

As you can see, if I use "anchor" and autoscaleall, I have the posibility to adjust the width, but.. could I have the possibilty to adjust the heigth????

Thanks

upload_2017-5-24_13-22-0.png





upload_2017-5-24_13-28-18.png
 
Upvote 0

Pilar-JLSineriz

Active Member
Licensed User
Longtime User
Thanks Erel

I wrote in this post because a I thought that the question has been created.
Sorry and thanks again for your help

Pilar
 
Upvote 0
Top