Layout problem with larger screens

William Hunter

Active Member
Licensed User
Longtime User
I have been trying to create a layout for a larger tablet. I have an app originally created for a 7” tablet at 800x480 and a density of 1. The landscape and portrait layouts, created in the designer, work very well with no need to use the scripting feature. This is not a complex layout, consisting of only one panel, two labels, three buttons and a scrollview.

I then used the designer to create layouts for a larger tablet, at 1028x800 and a density of 1. This did not work well. Landscape was close, but portrait was very poor in the positioning of elements. I then duplicated the location specs of the various elements into script, with the thought that I could fine-tune the layout with changes to that script. That did not work at all. I cannot make changes to the layout using script. Changes do not register, no matter how outrageous a change I might make.

I have included (android:xlargeScreens="true") in the manifest. I’m using Android 3.2 as the virtual device. I do not have an actual device for testing, and wonder if this might be a problem inherent to the virtual device.

Has anyone else experienced a similar problem, in working with layouts for larger screens? Is there a means of creating layouts for larger screens without this positioning problem?
 

dunski

Member
Licensed User
Longtime User
10" Tablet Layout Problem also

Hi,
This is my first post here on b4a. Was very excited to see this site and software so just downloaded it a few days ago. Unfortunately I'm having a nightmare just creating a 10" layout also. Its really disappointing cause I've spent 2 days at it now and I'm getting nowhere. I've followed the instructions in the beginners guide and even written the MyFirstProgram without a hitch. But when I run my 10" tablet layout it just bunches everything into boxes on top of each other into a small panel in the middle of the emulator screen. I only need this app in Landscape. Im running it on android 4.0. with just an emulator.

If anyone could tell me what Im doing wrong I would be very grateful.

:sign0085:
Dunski
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
@dunski

Did you create a layout variant (screen template) for your tablet's resolution? If not, what resolution are you using?
 
Upvote 0

dunski

Member
Licensed User
Longtime User
@dunski

Did you create a layout variant (screen template) for your tablet's resolution? If not, what resolution are you using?

HI rfresh,

Yes I did. I added a variant for the 10" Tablet Landscape 1280 x 800.
 
Upvote 0

dunski

Member
Licensed User
Longtime User
I originally designed the layout in the emulator. That is when all the views shrunk and bunched up together when I ran it. After I stopped it they were still bunched up in the emulator in design time. After spending about an hour adding and setting up views they were useless.

So I started again and this time I designed it in the Abstract designer and now all the buttons are way too big when I run it in the emulator.

Am I missing something when setting up and launching the emulator from the AVD do you think?
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
Do you have any code at all in the Designer Script window? Are you using that feature? It's new for B4A Ver 1.90.

You can use the Designer Abstract and manually set your buttons, etc. width, height, etc. in the 'grid', the section where all the properties are -- or -- you can set the height, width, etc. inside the Designer Script window using code.

I recommend doing it in the Designer Script window using code. When you connect your emulator to it, you can press F5 and see immediate layout changes that you have made in code.

Remember, when using Designer Scripts window, only placement and positioning and size code works, it's not like coding in the main IDE section where you can use any B4A code.

There is a bug confirmed in Ver 1.90 Designer Scripts where at least one line of code must be in the All variants script top window, so you can put anything in there as long as there is at least one line. I put all my code in the bottom section, specific to that template/variant. I too have the same tablet template you do.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
@dunski, you should have started a new thread for your question.

@William, I tested your layout on a 10' tablet and it looks exactly like in the designer:

I think that you mistakenly left an empty space at the bottom of the 10' portrait variant:
SS-2012-05-01_09.37.18.png


I recommend you to use the new designer script feature instead of creating many variants.

Attached you will find an updated version of your layout file with only a single variant that will automatically adjust to all screens.
 

Attachments

  • main10.bal
    4.8 KB · Views: 193
Upvote 0

dunski

Member
Licensed User
Longtime User
Sorry for hijacking this thread I will start a new one to let you know how I get on. Thanks very much rfresh and Njdude. My laptop just died this morning (hopefully its just a charger) anyway when I install the b4a on my desktop in the mean time. I believe I can install it twice. As soon as I get up and running again I can hopefully sort this out with your help. Thanks very much for your support.
Dunski
 
Upvote 0

William Hunter

Active Member
Licensed User
Longtime User
I recommend you to use the new designer script feature instead of creating many variants.

Attached you will find an updated version of your layout file with only a single variant that will automatically adjust to all screens.
Thank you Erel. It seems that I was adding unnecessary complexity to the creation of layouts. I had no idea that it could be done so simply, until I saw your designer layout and scripting. How did you create the seperation between buttons? I can't see how you might have done this.

Best regards
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Top