Android Question How to adjust views on the screen?

vecino

Well-Known Member
Licensed User
Hello, my sotware is made for 1280x800 screens.
Now I set it to 1366x768 screens.
How do I adjust easily?
 

Martincg

Member
Licensed User
Probably you should read this.

In the designer select the layout and it will be a copy of the original when you first add it as a new variant. Then in the Designer scripts you can specify all the positions and sized for the views.

The way you could do it in your program is to add something like this in the Sub Activity_Create.

If FirstTime then
'assuming the layout is a copy of the first variant
Dim v As View
Dim aspx As float = 1366/1280
Dim aspy As Float = 768/800
For i = 0 Activity.NumberOfViews - 1
v = Activity.GetView(i)
v.width=v.width *aspx
v.height = v.height * aspy
v.left = v.left * aspx
v.top = v.top * aspy
Next

Caveats:
I'm a newbie with 1 weeks experiance so any advice I give can be safely ignored. There are probably better answers to come but thinking about other people's problems might help me learn.


End If
 

klaus

Expert
Licensed User
In the ScaleModule you have different options.
You can stretch
- like %x and %y.
- strech like AutoScale from the Designer.
- stretch according x and y scales.
- you can define a reference screen, not only the 'standard' screen size.

You might have a look at chapter 8.11.3 AutoScale more advanced examples in the Beginner's Guide.
 

vecino

Well-Known Member
Licensed User
Many possibilities. I'll read everything.
Thank you very much, folks.
 

klaus

Expert
Licensed User
Many possibilities.
Yes, and many solutions.
There is no magic function nor library to fit a given layout to every screen.
It depends also on the kind of application, what do you want to display on the screen at the same time on a small or big screen.
 

vecino

Well-Known Member
Licensed User
I will review all the information.
I want to decide the best method for my application.
Thank you very much.
 
Top