Android Question Visual Designer with percentable coordinates

sirjo66

Well-Known Member
Licensed User
Longtime User
Hello,
I'm using B4A version 7.80

With "Visual Designer" is very simple to develop a layout, but then it don't work very well on the devices (even if I use AutoScaleAll).
On the other hand, if I use code for to add views on the layout (with %x and %y) it works very well on devices but it's hard to develop a layout.

Question: is there a system for to use "Visual Designer" with %x and %y ???

Many thanks
Sergio
 
Last edited:

udg

Expert
Licensed User
Longtime User
You can use the Designer Script area to set values based on x% and y% although (generally speaking) Anchors are the preferred method.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
You can use the Designer Script area to set values based on x% and y% although (generally speaking) Anchors are the preferred method.
Have anchors to do something with views resizing? Only partially, because anchors are only relative to the sides of the layout.

is there a system for to use "Visual Designer" with %x and %y ???
Set AutoScaleRate to 1 and watch what happens.

Try to replace Button6 with, for example, 20 imageviews (5 rows, 4 columns), inside a panel or not, and adapt this layout for any screen device (portrait only).
 
Last edited:
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
In this case I would use a mix of anchors and % to get the basic desires results that I need including multiple layouts if need be. Anyway this is not the place to start this discussion as this is not helping the helping @sirjo66 with his original query @LucaMs
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
In this case I would use a mix of anchors and % to get the basic desires results
If you have to use %, why not do it for the whole layout?

Anyway this is not the place to start this discussion as this is not helping the helping @sirjo66 with his original query @LucaMs
I'm not sure about his question.

I think he knows that he can write scripts and use percentages there. Maybe he means what I wrote here:
https://www.b4x.com/android/forum/threads/designer-code-generator.55843/

https://www.b4x.com/android/forum/threads/create-your-layouts-based-on-percentages.56155/

This is a similar question (I found it but not yet read):
https://www.b4x.com/android/forum/threads/stretch-views-in-designer-to-all-screen-size.63396/
 
Last edited:
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I tried... without success (even AutoScaleRate(1) does not solve).
Another attempt: using module Scale.

I used it in the past, succesfully; this time, with this test project (see posts #5 and #6), the result is wrong:

Maybe I forgot to set something (I had not used this module for a long time. Although this is not the problem, in some versions of Scale the SetRefenceLayout routine required two other parameters, boolean for full screen and title shown, which are no longer in the last version).

1) Why Scale seems to not work well on this project?

2) So, what is the best way for that layout?
Is it correct to say that for the central part it is necessary to use percentages (and therefore it is worth using them for the whole layout)?


Thank you
 

Attachments

  • LayoutTest 987 module.zip
    16.3 KB · Views: 200
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
1) Why Scale seems to not work well on this project?
No answers?

My intention is to always use the Scale module in the future; but I must first understand if I have made some mistakes in that small project or if it is imperfect.

[I forgot to specify on which screen I got the result I published in the previous post: 800 x 1280 - scale 1]
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…